在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ Vue里 用v-html解析了一段富文本,但是里面的img圖片卻不顯示?

Vue里 用v-html解析了一段富文本,但是里面的img圖片卻不顯示?

我在后臺(tái)拿到數(shù)據(jù)用v-for循環(huán)取出值后,用v-html解析了一段后臺(tái)拿到富文本,但是里面的img卻不顯示,是路徑問題還是怎么?以下是我的代碼:

<template>
<div>

<!--頁面主體-->
<div class="main container">
  <div class="news_details">
    <div  v-for="n in list">
        <h2>{{n.title}}</h2>
        <span>發(fā)布時(shí)間: {{n.pubTime}}</span>
        <div class="news_content" >
          <p v-html="n.content"></p>
        </div>
    </div>
  </div>
</div>

</div>
</template>

后臺(tái)拿數(shù)據(jù)處理:

.then((response)=>{
this.newsContentList =response.body ;
this.list.push(this.newsContentList);
},

渲染之后:
圖片描述

圖片沒出來,想要這樣的效果:
圖片描述

sql和文檔路徑是:
圖片描述

圖片描述

回答
編輯回答
安淺陌

這樣寫是不行的,assets目錄下的文件會(huì)被webpack處理,打包之后不是這個(gè)路徑了。需要把你的圖片放到static目錄下。對于的src的路徑寫成/static/xxxxxx

2018年9月9日 22:16