第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue數(shù)據(jù)處理時候?qū)慴acground圖片路徑的格式是怎么樣的

vue數(shù)據(jù)處理時候?qū)慴acground圖片路徑的格式是怎么樣的

大話西游666 2019-03-22 15:19:18
<el-carousel :interval="3500" arrow="always" >  <el-carousel-item  v-for="img in carouselFigures" :key="img.id">    <a  :style="{background: img.index}" target="_blank" class="aaa">    </a>  </el-carousel-item></el-carousel>接受數(shù)據(jù)代碼const that = this;console.log(that);//輪播圖this.$http.get(  that.$interface_+'getRecentImgs')  .then(function (response) {    if(response.data.status === 1){      response.data.data.forEach(function(item){        that.carouselFigures.push({          src:item.location,          index:("url(" + require(item.src) + ")"),          description:item.description        });      });    }else{      that.$message({        message: response.data.msg,        type: 'warning'      });    }  })  .catch(function (err) {    console.log(err);    that.$message({      message: '數(shù)據(jù) error',      type: 'warning'    })  });    **控制臺提示**  [Vue warn]: Invalid prop: type check failed for prop "index". Expected String, got Undefined.    請問那個background的路徑該用什么格式寫啊
查看完整描述

2 回答

?
嗶嗶one

TA貢獻1854條經(jīng)驗 獲得超8個贊

<a :style="'background-image: url(' + img.src + ')'"></a>


查看完整回答
反對 回復 2019-04-09
?
侃侃爾雅

TA貢獻1801條經(jīng)驗 獲得超16個贊

index:("url(" + require(item.src) + ")"),

改為

index:("url(" item.src + ")"),

接口返回的圖片,應該不在本地吧,不需要 require


查看完整回答
反對 回復 2019-04-09
  • 2 回答
  • 0 關注
  • 602 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號