无法在 $refs 属性中添加样式。无法设置未定义的属性“cssText”。这可能吗?找不到类似的
this.$refs['ticketCode_'+this.resoTrans_id].style.cssText =
"background-color:#66BB6A !important; border:1px solid #66BB6A !important; color:#fff !important;";
打印没有 .style 似乎工作正常 console.log(this.$refs['ticketCode_'+this.resoTrans_id])
VueComponent {_uid: 493, _isVue: true, $options:
原文由 BGTabulation BGTabulate 发布,翻译遵循 CC BY-SA 4.0 许可协议
您不应该使用 cssText 而是使用 JavaScript API 来设置样式(您也可以在 $refs 上执行此操作):
更好的是直接在模板中利用 Vue 的强大功能: