Compare commits
5 Commits
7b1ee4fa97
...
94f433de6e
Author | SHA1 | Date | |
---|---|---|---|
94f433de6e | |||
a9c476cb8e | |||
5c3833d4cb | |||
6e627d11c8 | |||
eb644fa494 |
@ -1,39 +0,0 @@
|
|||||||
import { h, ref } from 'vue'
|
|
||||||
|
|
||||||
const ActiveComponent = function(props, { attrs, slots }) {
|
|
||||||
const key = props.pkey
|
|
||||||
const isActive = ref(false)
|
|
||||||
|
|
||||||
function onMouseover() {
|
|
||||||
console.log('activated ' + key)
|
|
||||||
isActive.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMouseleave() {
|
|
||||||
console.log('disabled ' + key)
|
|
||||||
isActive.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
return h(props.as, {
|
|
||||||
...attrs,
|
|
||||||
class: 'hello',
|
|
||||||
onMouseover,
|
|
||||||
onMouseleave,
|
|
||||||
}, [
|
|
||||||
slots,
|
|
||||||
slots.default({ isActive }),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
ActiveComponent.props = {
|
|
||||||
as: {
|
|
||||||
type: String,
|
|
||||||
default: 'div',
|
|
||||||
},
|
|
||||||
pkey: {
|
|
||||||
type: Number,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ActiveComponent
|
|
Loading…
x
Reference in New Issue
Block a user