vue 图片赋值小结

2022-08-25  本文已影响0人  iOS开发小学生
<template>
  <div id = "app">
    <div id = "lunbo" v-for="item in listOne" :key="item">
      <img id = "img" :src = "item"  width="100%" height="200px"/>
    </div>
  </div>
</template>

<script>
  export default{
    data(){
      return{
        imgurl: require('./../assets/yekong.png'),
        listOne: [
                require("./../assets/yekong.png"),
                require("../assets/yekong.png"),
                require("@/assets/yekong.png"),
              ],
      }
    },
  }
</script>

记住几个方法

require("./../assets/yekong.png"),
require("../assets/yekong.png"),
require("@/assets/yekong.png")

上一篇下一篇

猜你喜欢

热点阅读