使用vue做标题高亮,使用v-html="ruleTitle(item)"无法获取到数据
<div
class="task-list-item-container"
v-for="(item, index) in taskList.slice((pagination.currentPage-1)*pagination.size, pagination.currentPage*pagination.size)"
@click="openDetailPage(item)"
@mouseenter="enterTaskItem(index)"
@mouseleave="leaveTaskItem(index)"
>
<div class='task-cover-container'>
<img :src="taskCoverUrl"/>
</div>
<div class="task-list-item-detail-container">
<div>
<div class="task-list-item-detail-title-container">
<div class="task-list-item-detail-title-text" v-html="ruleTitle(item)">
</div>
<div class='task-list-item-detail-title-icons'>
<div
class='thumb-image-container'
:class="{'thumb-image-controller':thumbIndex===index}"
>
<img :src="thumbUrl"/>
</div>
<div
class='star-image-container'
:class="{'star-image-controller':starIndex===index}"
>
<img :src="starUrl"/>
</div>
</div>
</div>
<div class="task-list-item-detail-tags-container">
<div class="task-list-item-detail-tag-item">任务分类</div>
<div class="task-list-item-detail-tag-item ml8px">任务难度</div>
<div class="task-list-item-detail-tag-item ml8px">任务剩余天数</div>
</div>
<div class='task-list-item-detail-message'>{{item.content}}</div>
</div>
<div class="task-list-item-detail-date-container">
<div class="task-list-item-detail-create-date">
<div class="time-clock-container">
<div class="time-clock-wrapper">
<img :src="timeClockUrl"/>
</div>
</div>
<div>发布时间:{{item.createDate}}</div>
</div>
<div class="task-list-item-detail-participate">
<div class="mr16px"><span class="task-list-item-detail-participate-text">{{item['participateCount']}}</span>人参与</div>
<div><span class="task-list-item-detail-participate-text">{{item['concernCount']}}</span>人关注</div>
</div>
</div>
</div>
</div>
computed: {
ruleTitle(val) {
console.log(val)
return "<a href='https://blog.csdn.net/zl18603543572'>早起的年人的文章</a>"
}
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ruleTitle 你写成了计算属性