按照文档开启reactivityTransform功能报错 #6129
              
                Unanswered
              
          
                  
                    
                      teaim
                    
                  
                
                  asked this question in
                Help/Questions
              
            Replies: 1 comment 7 replies
-
| 
 Vite
 // vite.config.js
export default {
  plugins: [
    vue({
      reactivityTransform: true
    })
  ]
}...... 其他请看文档 显式启用 | 
Beta Was this translation helpful? Give feedback.
                  
                    7 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
按照文档开启了reactivityTransform功能
https://vuejs.org/guide/extras/reactivity-transform.html#refs-vs-reactive-variables
代码里面
虽然$ref会全局自动导入, 但是我的ide无法识别$ref会报红, 为了消除这个异常, 我按照文档说明手动添加了下面这行

import { $ref } from 'vue/macros'
结果代码跑起来就报错
假如去掉手动导入$ref这个步骤, 代码是可以正常运行的
所以这里文档是不是描述错了
@yyx990803
Beta Was this translation helpful? Give feedback.
All reactions