• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

139
Vistas
How to select the vue js el using CSS attribute selector?

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?

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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>

about 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda