Reputation: 1361
I have this HTML:
<div data-identifier='app'>
...
</div>
And I have this Vue js code:
var app = new Vue({
el: '[data-identifier]',
data: {
},
methods: {
}
});
But it seems that Vue does not understand [data-identifier]
CSS selector.
How can I use attribute CSS selector with Vue js?
Upvotes: 0
Views: 226
Reputation: 1
It should work as shown below:
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>
Upvotes: 1