目录
- 错误提示:Uncaught SyntaxError: Unexpected token u in JSON at position 0
- 错误提示:Duplicate keys detected: '0'. This may cause an update error.
- 错误提示:Do not use built-in or reserved HTML elements as component id
- 错误提示:No PostCSS Config found in
- 错误提示:[Vue warn]: Invalid prop: type check failed for prop “value”. Expected String, Number, got Undefined
错误提示:Uncaught SyntaxError: Unexpected token u in JSON at position 0
某个地方用了JSON.parse,但是传入的参数不是一个合格的json字符串。
解决:搜索一下,parse,解析前先判断一下
parse前记得判断下
错误提示:Duplicate keys detected: ‘0’. This may cause an update error.
错误原因
一个template中有两个一样的v-for
<div class="info" v-for="(item, index) in currentFriend.content" :key="index">
<div class="d1">
<p v-text="item.time" class="timeBox"></p>
</div>
</div>
<div class="info2" v-for="(item, index) in currentFriend.content" :key="'index">
<div class="d2">
<p v-text="item.time" class="timeBox"></p>
</div>
</div>
解决办法
将其中以个的key修改一下
<div class="info2" v-for="(item, index) in currentFriend.content" :key="'info2-'+index">
<div class="d2">
<p v-text="item.time" class="timeBox"></p>
</div>
</div>
错误提示:Do not use built-in or reserved HTML elements as component id
vue 在引入组件后无法显示组件内容且报错。
这是因为组件的命名和html标签重复导致警告
解决方法:
创建组件的时候要注意组件命名与html标签区分开
错误提示:No PostCSS Config found in
问题描述
执行 npm install 命令安装所有依赖后运行 npm run dev 报错:
error in ./node_modules/view-design/dist/styles/iview.css
Module build failed: Error: No PostCSS Config found in: /Users/lanweihong/Code/JS/hotel-pms/node_modules/view-design/dist/styles
at config.search.then (/Users/lanweihong/Code/JS/hotel-pms/node_modules/postcss-load-config/src/index.js:91:15)
at <anonymous>
解决方法
在项目根目录下新建 postcss.config.js 文件。postcss.config.js是针对webpack3.0做的特殊处理。
postcss.config.js
module.exports = {
plugins: {
'autoprefixer': {browsers: 'last 5 version'}
}
}
重新运行 npm run dev 。
错误提示:[Vue warn]: Invalid prop: type check failed for prop “value”. Expected String, Number, got Undefined
解决方法
一般是组件绑定的值取不到