gpt4 book ai didi

vuejs2 - 你如何强制 Vue 使用 v-bind 显示虚假属性?

转载 作者:行者123 更新时间:2023-12-04 17:43:41 24 4
gpt4 key购买 nike

<button class="navbar__dropdown-toggle" :aria-expanded="active"></button>

我正在尝试绑定(bind) aria-expanded到下拉菜单的状态。不幸的是,当使用屏幕阅读器(视障人士)时,听写并不表示它是一个非扩展的下拉菜单,因为虚假属性已被删除。

有没有办法强制保留虚假属性?

最佳答案

看起来像来自 W3C specaria-expanded 的值可以是真或假。所以在你的模板中你可以做到这一点。

<button class="navbar__dropdown-toggle" :aria-expanded="active ? 'true' : 'false'">expanded</button>

工作 example .

关于vuejs2 - 你如何强制 Vue 使用 v-bind 显示虚假属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45204191/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com