Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Vue.component('vmodel-arrays', {
data () {
return {
frameworks: []
}
},
template: `
<div>
<h2>vmodel con arrays en Vue 2</h2>
<input type="checkbox" id="vue" value="Vue" v-model="frameworks" />
<label for="vuejs2">Vue</label>
<input type="checkbox" id="laravel" value="Laravel" v-model="frameworks" />
<label for="reactjs">Laravel</label>
<input type="checkbox" id="django" value="Django" v-model="frameworks" />
<label for="django">Django</label>
<p>Frameworks seleccionados: {{ frameworks }}</p>
</div>
`
})
app.component("vmodel-arrays", {
setup() {
const frameworks = ref([]);
return { frameworks };
},
template: `
<h2>v-model con arrays en Vue 3</h2>
<input type="checkbox" id="vue" value="Vue" v-model="frameworks" />
<label for="vuejs2">Vue</label>
<input type="checkbox" id="laravel" value="Laravel" v-model="frameworks" />
<label for="reactjs">Laravel</label>
<input type="checkbox" id="django" value="Django" v-model="frameworks" />
<label for="django">Django</label>
<p>Frameworks seleccionados: {{ frameworks }}</p>
`
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment