Vue3 语法糖

<template>
<div ref="node" >   <node v-bind="$attrs"/>
  </div>
</template>
<script setup>
//要带.vue
import  node from './node.vue'
import { ref,reactive,getCurrentInstance } from 'vue'
var ctx = getCurrentInstance().ctx const props = defineProps({ foo: String })
const emit = defineEmits(["clickNode","changeNodeSite"])
var a = ref(!1)
var b =
reactive({n:1})
console.log(ctx.$.refs.node)
//属性不穿透
ctx.$.inheritAttrs = false
defineExpose({ a, b })
</script>

 

posted @ 2022-06-06 11:26  87de海雷  阅读(71)  评论(0编辑  收藏  举报