12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { defineComponent, toRefs, reactive, onMounted, ref, watch } from 'vue'
- import { ElTag } from 'element-plus'
- import classes from './index.module.less'
- export default defineComponent({
- name: 'tagItem',
- emits: ['searchTag'],
- props: {
- title: {
- type: String,
- default: ''
- },
- isChiose: {
- type: Boolean,
- default: false
- },
- item: {
- type: Object,
- default: { isCheck: false }
- },
- isSmall: {
- type: Boolean,
- default: false
- }
- },
- setup(props, conent) {
- const state = reactive({
- title: props.title,
- isCheck: props.item.isCheck,
- isSmall: props.isSmall
- })
- const shioseTag = (key: string) => {
- conent.emit('searchTag', key)
- }
- watch(
- () => props.item,
- item => {
- state.isCheck = item.isCheck
- },
- {
- deep: true
- }
- )
- const checkDrak = () => {
- if (props.isChiose) {
- state.isCheck = true
- }
- }
- return () => (
- <>
- {/* effect={state.isCheck ? 'dark' : 'light'} */}
- <div
- onClick={() => shioseTag(state.title)}
- class={[classes.tag, state.isSmall ? classes.small : '']}
- >
- {state.title}
- </div>
- </>
- )
- }
- })
|