1.方法里面写console.log()报错

解决:新建vue.config.js

  1. module.exports={
  2. lintOnSave:false
  3. }

2.图片写了三目表达式出不来

解决:使用require( )

  1. <img @click="handleClick" :src="require(isShow?'@/assets/pause.png':'@/assets/play.png')">
  1. <van-swipe-item v-for="(image, index) in images" :key="index" @click="handleClick(index)">
  2. <img v-lazy="image" />
  3. </van-swipe-item>
  4. data(){
  5. return{
  6. images: [
  7. require('../../assets/01.png'),
  8. require('../../assets/02.png'),
  9. require('../../assets/03.png'),
  10. require('../../assets/04.png'),
  11. require('../../assets/05.png'),
  12. ]
  13. }
  14. },

3.Duplicate keys detected:’’

image.png

原因:
:key = “item”
解决:
:key = “item.id”

4.解决:methods

image.png
原因:method:{ }
解决:methods:{ }

5.如果图片取不到

在public/index.html中输入

  1. //<head></head>
  2. <meta name=referrer content=never>

image.png