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>