2
Hello I want to do the following, I use data types to create customizable properties, but wanted to do as Vuejs it has v-model v-on among others this properties and created using Htmlelement?
2
Hello I want to do the following, I use data types to create customizable properties, but wanted to do as Vuejs it has v-model v-on among others this properties and created using Htmlelement?
3
You can use the v-bind
to pass an object to the template that will record these attributes in HTML.
An example would be like this:
new Vue({
el: '#app',
data: {
customProps: {
'data-foo': 100,
'data-bar': 'algo'
},
message: 'Olá Vue.js!'
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"></script>
<div id="app">
<p v-bind="customProps">{{ message }}</p>
</div>
And the resulting HTML is:
<p data-foo="100" data-bar="algo">Olá Hello Vue.js!</p>
It may not be what he’s asking, but I learned something new from his answer! :)
Browser other questions tagged javascript vue.js
You are not signed in. Login or sign up in order to post.
@Did Sergio really understand the question? Not me. Matheus, do you want to do something in Vue, or do on your own similar to Vue?
– bfavaretto
@bfavaretto to me is clear the problem, an app that uses datatypes (attributes
data-
), hence my suggestion to use thev-bind
. But I can clearly be wrong.– Sergio
I think he wants to implement a reactive mechanism on his own, @Sergio. He says "but he wanted to do like Vuejs".
– bfavaretto
@bfavaretto ok, as I said, I may be wrong. Let’s see what Matheus says.
– Sergio
Matheus reads the above comments . If my answer is wrong do not accept it, so we can clarify and give an appropriate response.
– Sergio
Hello, the answer was with double meaning kkk, but finally I really wanted and do the same Vuejs on its own ( make a reactive component )
– Matheus Militão