打包成静态站点后 <script setup> 中定义的属性 <script>中获取不到
Version
3.2.26
Reproduction link
Steps to reproduce
- npm install
- npm run build
- npm run preview
- 查看 console
What is expected?
this下能get这些属性
What is actually happening?
undefined
正常开发环境能get到 编译打包成静态站点后都get不到, vite 和 vue cli 都试过了, 都是一样的结果
This is because you declared the properties using the setup syntax. Use onMounted()
instead and keep only one version of the component: the composition or the setup version.
You can still access the ref through this.$refs.ref_form
though