0

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?

1 Answer 1

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>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.