options里怎么加html
时间: 2024-01-22 14:01:50 浏览: 20
在 `options` 数组中,可以使用 `v-html` 指令来插入 HTML,如下所示:
```
<q-btn-toggle
v-model="searchInfo.ViewType"
flat
toggle-color="primary"
@click="bindBaseInfo"
:options="[
{ label: 'In Process', value: 'InProcess', tabSelected },
{ label: 'In Clarification (<strong>' + InClarificationCount + '</strong>)', value: 'InClarification' },
{ label: 'Supplement Event Details (<strong>' + SupplementEventDetailsCount + '</strong>)', value: 'SupplementEventDetails' },
{ label: 'Completed', value: 'Completed' },
{ label: 'All', value: 'All' },
]"
/>
```
在上述代码中,使用了 `v-html` 指令来将 `<strong>` 标签插入到选项标签的文本中,并将 `InClarificationCount` 和 `SupplementEventDetailsCount` 的值嵌入到 `<strong>` 标签中,从而实现了加粗文本的效果。
需要注意的是,使用 `v-html` 指令时必须确保数据是可信的,以避免 XSS 攻击等安全问题。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)