使用Vue组件问题汇总

  • vue.runtime.esm.js:588 [Vue warn]: Do not use built-in or reserved HTML elements as component id: button

不要使用内置的或保留的HTML元素作为组件ID。有一种情况是组件的name选项设置为HTML元素button。在使用递归组件时需要设置组件的name选项。

  • TypeError: Cannot read property ‘validateSchema’ of undefined

webpack4.x缺少webpack-cli的安装:npm install webpack-cli --save-dev

  • 下载iview组件库源码执行npm run dev报错:

ERROR in ./node_modules/_css-loader@0.28.11@css-loader?{“sourceMap”:true}!./node_modules/vue-loader/lib/style-compiler?{“optionsId”:“0”,“vue”:true,“scoped”:false,“sourceMap”:true}!./node_modules/_less-loader@4.1.0@less-loader/dist/cjs.js?{“sourceMap”:true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./examples/app.vue

.bezierEasingMixin();
^
Inline JavaScript is not enabled. Is it set in your options?
in /Users/snow/program files/iview-2.0/src/styles/color/bezierEasing.less (line 110, column 0)
@ ./node_modules/vue-style-loader!./node_modules/_css-loader@0.28.11@css-loader?{“sourceMap”:true}!./node_modules/vue-loader/lib/style-compiler?{“optionsId”:“0”,“vue”:true,“scoped”:false,“sourceMap”:true}!./node_modules/_less-loader@4.1.0@less-loader/dist/cjs.js?{“sourceMap”:true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./examples/app.vue

一种解决方案是将依赖包中的less从3.x版本降级为2.x版本:
npm install less@2.7.3 --save-dev
这种方法能够解决其他类似.bezierEasingMixin();出错的问题。

  • npm run dev 启动vue项目,vue-router路由正常,刷新界面后出现Cannot GET /xxx

将路由模式关闭history模式,改为默认的hash模式,该问题解决。且webpack热更新也可以正常生效了。怀疑可能跟history模式需要服务器端进行配置,使所有路由指向同一个html有关。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值