Vue Bootstrap:如何在v-b-tooltip提示文本中使用双引号
解决Vue Bootstrap Tooltip中添加双引号的问题
有三种可行的方法可以实现给提示文本里的“Automatically”添加双引号且正常渲染:
方法一:使用HTML实体
"
用HTML实体替代双引号,避免和模板中的引号结构冲突,修改后代码如下:<label>Encoding <feather-icon icon="AlertCircleIcon" class="mr-50 my-icon" v-b-tooltip.hover.right="'The encoding used inside the feed. Leave "Automatically" if you are uncertain'" /> </label>方法二:调整引号嵌套逻辑
将指令属性的外层引号改为单引号,内部字符串直接使用双引号,不会出现引号匹配错误:<label>Encoding <feather-icon icon="AlertCircleIcon" class="mr-50 my-icon" v-b-tooltip.hover.right='The encoding used inside the feed. Leave "Automatically" if you are uncertain' /> </label>方法三:使用ES6模板字符串
用反引号包裹提示文本,内部可直接使用双引号(可选转义\"以避免编辑器语法提示报错):<label>Encoding <feather-icon icon="AlertCircleIcon" class="mr-50 my-icon" v-b-tooltip.hover.right="`The encoding used inside the feed. Leave \"Automatically\" if you are uncertain`" /> </label>
内容的提问来源于stack exchange,提问作者Shibbir
相关产品推荐
相关产品推荐

