vue-directives

|| SOLVED || Add Vue directives in Nuxt (CLIENT side only)

我的梦境 提交于 2020-05-28 09:44:12
问题 How to add directives in nuxt: Note: this is only for client-side 1- /plugins/directives.js: import Vue from 'vue' Vue.directive('getelement', { bind(el, { value: { index, items } }) { el.addEventListener('click', (event) => { event.stopPropagation() console.log(el, index, items) // do whatever }) } }) 2- /nuxt.config.js plugins: [ ... // DIRECTIVES : client ONLY { src: '~/plugins/directives.js', mode: 'client' } ] 3- component.vue <img v-for="(item, index) in items" v-getelement="{ items,

|| SOLVED || Add Vue directives in Nuxt (CLIENT side only)

与世无争的帅哥 提交于 2020-05-28 09:43:26
问题 How to add directives in nuxt: Note: this is only for client-side 1- /plugins/directives.js: import Vue from 'vue' Vue.directive('getelement', { bind(el, { value: { index, items } }) { el.addEventListener('click', (event) => { event.stopPropagation() console.log(el, index, items) // do whatever }) } }) 2- /nuxt.config.js plugins: [ ... // DIRECTIVES : client ONLY { src: '~/plugins/directives.js', mode: 'client' } ] 3- component.vue <img v-for="(item, index) in items" v-getelement="{ items,

Dynamic v-model don't complete inputs using v-html directive

我的未来我决定 提交于 2019-12-24 13:25:58
问题 I have a component where I applied <div v-html="dataProperties.replace(/name/g, index)"> Inside the dataProperties which is raw HTML, I have an input tag with v-model="data[name].property" except that the input stay empty even if data[index].property exist and isn't null in my component data. <template> <div class="entity-list" :class="{'client-empty': !entities.length, row: entities.length}"> <div v-for="(entity, index) in entities" class="col-md-6 entity-item"> <div class="data"> <slot