This commit is contained in:
parent
a05ff35a3a
commit
348e635f7f
|
@ -22,12 +22,12 @@
|
|||
<ul class="infinite-list" v-infinite-scroll="load" :infinite-scroll-immediate="false" style="overflow:auto">
|
||||
<li class="problem_right_container" v-for="item in getQaLists">
|
||||
<div class="title">
|
||||
<span v-html="item.title"></span>
|
||||
<span v-html="handleprant(item.title)"></span>
|
||||
<el-button @click="handleZip(item.img_zip)" type="primary">下载图片</el-button>
|
||||
<el-button @click="handleZip(item.trip_zip)" type="primary">下载行程</el-button>
|
||||
</div>
|
||||
<div class="desc_container" v-for="list in item.qaQuestions">
|
||||
<div style="font-weight: 700;" class="desc" v-html="list.title"></div>
|
||||
<div style="font-weight: 700;" class="desc" v-html="handleprant(list.title)"></div>
|
||||
<div class="desc" v-html="handleprant(list.content)"></div>
|
||||
</div>
|
||||
|
||||
|
@ -77,21 +77,22 @@ export default {
|
|||
console.log('load')
|
||||
},
|
||||
handleprant(val){
|
||||
let replaceReg = new RegExp(7, "ig");
|
||||
let replaceString = `<span style="color: #fca104">7</span>`;
|
||||
let replaceReg = new RegExp(this.dataForm.keyword, "ig");
|
||||
let replaceString = `<span style="color: #fca104">${this.dataForm.keyword}</span>`;
|
||||
return val.replace(replaceReg, replaceString);
|
||||
},
|
||||
onSubmit(){
|
||||
getQaList(this.dataForm).then(res => {
|
||||
this.getQaLists = res.data.data.map((item, index) => {
|
||||
if (this.dataForm.keyword) {
|
||||
let replaceReg = new RegExp(this.dataForm.keyword, "ig");
|
||||
let replaceString = `<span style="color: #fca104">${this.dataForm.keyword}</span>`;
|
||||
item.title = item.title.replace(replaceReg, replaceString);
|
||||
item.content = item.content.replace(replaceReg, replaceString);
|
||||
}
|
||||
return item
|
||||
});
|
||||
// this.getQaLists = res.data.data.map((item, index) => {
|
||||
// if (this.dataForm.keyword) {
|
||||
// let replaceReg = new RegExp(this.dataForm.keyword, "ig");
|
||||
// let replaceString = `<span style="color: #fca104">${this.dataForm.keyword}</span>`;
|
||||
// item.title = item.title.replace(replaceReg, replaceString);
|
||||
// item.content = item.content.replace(replaceReg, replaceString);
|
||||
// }
|
||||
// return item
|
||||
// });
|
||||
this.getQaLists = res.data.data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue