Property ‘$test‘ does not exist on type ‘ComponentPublicInstance

news/2024/5/20 3:17:59 标签: ts

eviroment

vue3 + ts

problem

期望使用全局变量

ts">// main.ts
app.config.globalProperties.$test = 123

// test.vue
console.log(`this.$test`, this.$test

http://www.niftyadmin.cn/n/1463049.html

相关文章

[vue3] error in ./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js

question 使用vue-cli(4.5.13) create vue3(3.1.3) npm run server error error in ./node_modules/vue/reactivity/dist/reactivity.esm-bundler.js solution1 办法1: 编辑配置文件vue.config.js 此办法不行 // vue.config.js module.exports {transpileDependencies:…

Cannot find module ‘@/components/test1.helloworld/test1.vue‘ or its corresponding type declarations.

error Cannot find module ‘/components/test1.helloworld/test1.vue’ or its corresponding type declarations.Vetur(2307) solution // 此写法会报错 import Test11 from /components/test1.helloworld/test1.vue // 此写法不会报错 import Test11 from ../components/…

[vuepress] TypeError: Cannot destructure property `createHash` of ‘undefined‘ or ‘null‘.

error 启动vuepress时报错 原因:项目中使用了webpack3,如果用npm方式来安装vuepress(v1.4.x)会出现安装依赖出错 resolution1 使用yarn代替npm安装,再次启动vuepress即可 npm uninstall vuepress yarn add -D vuepress resolution2 将…

[webpack] [HMR] Hot Module Replacement is disabled

error webpack提示 [HMR] Hot Module Replacement is disabled resolution 解决办法是webpack配置里添加HMR插件即可

[webpack] Configuration Error: Avoid modifying webpack output.publicPath directly.

goal vue-cli脚手架生成的项目,想要配置webpack下的output.publicPath选项 配置1 module.exports = {configureWebpack: {publicPath: http://localhost:8080/,} }报错 configuration has an unknown property ‘publicPath’. These properties are valid: output? 理解…

[webpack] Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint in

enviroment webpack 4.0 extract-text-webpack-plugin error Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead reason 没有使用最新的npm 包 resolution npm i -D extract-text-webpack-pluginnext

[webpack]zsh: command not found: webpack

eviroment 环境:mac 工程已安装局部依赖包 npm install webpack webpack-cli -D 配置好webpack.config.js文件 error 但执行webpack报错 zsh: command not found: webpack resolution 因为当前环境变量中,没有找到对应的命令,解决方…

[wechat] Error: EEXIST file already exists open /User/.../Library/Application Support/微信开发在工具/...js

operation 引入vant-weapp之后 小程序开发工具可以展示 vant-button组件了 但是预览编译失败 error Error: EEXIST file already exists open /Users/dream/Library/Application Support/微信开发者工具/…/Weappdest/…/pages/demoFile/demofile.js why? 事实上本地源…