使用脚手架创建的Vue2项目,main.js中import标红怎么解决,也能运行,就是看着特别难受,快逼死强迫症了,其他两个文件也都有标红
参考博客:https://www.cnblogs.com/hmy-666/p/16441069.html
我找了半天,里面给出了正确解决办法
报错信息是啥
你把光标移动到红色波浪线上,看有啥提示信息
(1)main.js
import Vue from 'vue'
import progressive from 'progressive-image/dist/vue'
import 'progressive-image/dist/index.css'
Vue.use(progressive, {
removePreview: true,
scale: true
})
(2)demo.vue
<template>
<div class="progressive" v-for="(item,index) in imgs" :key="index">
<img class="preview" v-progressive="item.src" :src="item.preview" />
</div>
</template>
<script>
export default {
data(){
return {
imgs: [
{
src: 'http://7xiblh.com1.z0.glb.clouddn.com/progressive/2.jpg',
preview: 'http://7xiblh.com1.z0.glb.clouddn.com/progressive/r2.jpg'
},
{
src: 'http://7xiblh.com1.z0.glb.clouddn.com/progressive/3.jpg',
preview: 'http://7xiblh.com1.z0.glb.clouddn.com/progressive/r3.jpg'
}
]
}
},
}
</script>
参考链接:
1.https://github.com/ccforward/cc/issues/64?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io