[英]How to select the vue js el using CSS attribute selector?
我有這個 HTML:
<div data-identifier='app'>
...
</div>
我有這個 Vue js 代碼:
var app = new Vue({
el: '[data-identifier]',
data: {
},
methods: {
}
});
但似乎 Vue 不理解[data-identifier]
CSS 選擇器。
如何在 Vue js 中使用屬性 CSS 選擇器?
它應該如下所示工作:
var app = new Vue({ el: '[data-identifier]', data: { msg:"hello" }, methods: { } });
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div data-identifier='app'> {{msg}} </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.