index.tsx 623 B

12345678910111213141516171819202122232425262728
  1. import { defineComponent , toRefs, reactive, onMounted, ref } from 'vue'
  2. import { ElTag } from 'element-plus'
  3. import classes from './index.module.less'
  4. export default defineComponent({
  5. name: 'tagItem',
  6. emits:['searchTag'],
  7. props: {
  8. title: {
  9. type: String,
  10. default: ''
  11. }
  12. },
  13. setup(props, conent) {
  14. const state = reactive({
  15. title:props.title
  16. })
  17. const shioseTag =(key:string)=>{
  18. conent.emit('searchTag',key)
  19. }
  20. return () => (
  21. <>
  22. <ElTag size="large" onClick={()=>shioseTag(state.title)} class={classes.tag}>{state.title}</ElTag>
  23. </>
  24. )
  25. }
  26. })