Vue · 报错

错误提示: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

解决方法
一般是组件绑定的值取不到

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值