vue.js - 动态显示工具提示
问题描述
我需要动态显示工具提示。在 span 标签内编写 v-for 循环时出现错误。
<span v-if="documentType === 'CourierReciept' && documentGroup === 'CourierDocuments'">
<label>{{UploadText}} {{f.DisplayName}}</label>
<span v-if="f.IsRequired == true">*</span>
<span v-tooltip=" <span v-for= "(s,index) in staticText" :key="index">
{{staticText.name}}>"<i class="fa fa-info-circle" aria-hidden="true"></i>
</span>
</span>
解决方案
我在 VUE 中搜索了相同的查询“动态显示工具提示”。结果我得到了这个。
通过进一步研究,我发现这种语法有效:
v-bind:title=data.res
在这里,它在 forloop 中使用:
<div v-for="item in data">
<div v-bind:title=item.from >{{item.from}} | {{item.date}}</div> <----- HERE ---
</div>