33 lines
541 B
Vue
33 lines
541 B
Vue
<template>
|
|
<li :ref="element" @click="onClick($event)">
|
|
<slot></slot>
|
|
</li>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import {defineComponent, onMounted, onUpdated, ref} from "vue";
|
|
|
|
export default defineComponent({
|
|
name: "POption",
|
|
props: {
|
|
value: {
|
|
type: [String, Number, Object],
|
|
}
|
|
},
|
|
emits: ['select'],
|
|
setup(props,context) {
|
|
function onClick(e) {
|
|
e.target.data = props.value
|
|
}
|
|
const element = ref<HTMLElement>()
|
|
|
|
return {
|
|
element,onClick
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |