<script lang="ts" setup name="TagsView">
import path from "path";
import { useRoute, useRouter } from "vue-router";
import { useStore } from 'vuex';
let scrollPane = ref(null)
const tagLinkRef = ref<any>(null)
const tagesViewRef: any = ref(null)
onMounted(() => {
console.log(tagLinkRef.value, 'tagLinkReftagLinkRef');
});
</script>
由于业务关系,我并没有使用官方推荐的方式。
我找了不少,并没有找到具体有用的代码。
<template>
<div ref="root">This is a root element</div>
</template>
<script>
import { ref, watchEffect } from 'vue'
export default {
setup() {
const root = ref(null)
watchEffect(() => {
console.log(root.value) // => <div>This is a root element</div>
},
{
flush: 'post'
})
return {
root
}
}
}
</script>
···