【6月日新计划更文活动】第30天
Vue3报错及解决方法
-
!
setup中定义的数据一定要返回,不然页面无法获取到数据 ! -
Vue报错:
Can't resolve XXXvue配置路由如果出现can not resolve“@src/test/demo”,那极有可能是路径写错了,或者路径和上面的写重复了,检查路径 也可能引入了模块路径不对…… -
WebSocketClient.js?5586:16 WebSocket connection to 链接报错
// 修改 vue.config.js 文件中的 devServer配置,主要是 client 配置项 // webSocketURL和端口号设置一致 const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ devServer: { host: '0.0.0.0', // https:true, port: 6103, client: { webSocketURL: 'ws://0.0.0.0:6103/ws', }, headers: { 'Access-Control-Allow-Origin': '*', } }, transpileDependencies: true }) -
Vue3中console报错: 修改package.json中的
eslintConfig:{}中的“rules:{}”,增加一行代码:"no-console":"off""eslintConfig": { "rules": { "no-console": "off" } },