Vue.js

Vuex store.watch only accepts a function in Vue router guard

此生再无相见时 提交于 2021-02-17 06:05:30
问题 I am trying to watch and wait until Vue router guard will get final value from Vuex however it throws [vuex] store.watch only accepts a function Here is the code: const isAdmin = _.get(store, 'getters.user/isAdmin', undefined) if (to.matched.some(record => record.meta.isAdmin)) { if (isAdmin === undefined) { const watcher = store.watch(isAdmin, isAdmin => { watcher() // stop watching if (!isAdmin) next({ path: '/not-available' }) }) } else if (serv.isAuth() && !isAdmin) { next({ path: '/not

Vuex store.watch only accepts a function in Vue router guard

我只是一个虾纸丫 提交于 2021-02-17 06:05:23
问题 I am trying to watch and wait until Vue router guard will get final value from Vuex however it throws [vuex] store.watch only accepts a function Here is the code: const isAdmin = _.get(store, 'getters.user/isAdmin', undefined) if (to.matched.some(record => record.meta.isAdmin)) { if (isAdmin === undefined) { const watcher = store.watch(isAdmin, isAdmin => { watcher() // stop watching if (!isAdmin) next({ path: '/not-available' }) }) } else if (serv.isAuth() && !isAdmin) { next({ path: '/not

Click event in vuejs on custom component?

你说的曾经没有我的故事 提交于 2021-02-17 05:37:05
问题 I have in my main component one custom component and I need to fire a custom event on click, I tried it in this way: <child-component @click="fireCustomEvent"></child-component> This does not work and I tried to solve this problem with adding @click.native <child-component @click.native="fireCustomEvent"></child-component> With .native it works but it fires the event every time if I click inside my "child-component". Can I avoid somehow to fire this event again if I click inside "child

Vue 3 external component/plugin loading in runtime

两盒软妹~` 提交于 2021-02-17 05:27:05
问题 I am designing an architecture for the Vue 3 app with distributed module-based ownership. Module system will be represented with plugins (seems like the most appropriate solution allowing vuex module and vue-router dynamic injects). Each such module/plugin will be developed by dedicated team working within isolated repos. We cannot use npm package-per-plugin approach as deployment process should be isolated as well, and with npm approach core app team will have to rebuild app each time npm

Loader of individual files with VUE.JS doesn't work

那年仲夏 提交于 2021-02-17 05:14:42
问题 I am trying to mount a separate file loader with vue.js. Each loader can load only one file. According to the following code, the objective should be that in the structure ' adjuntos ' each loaded file get saved properly. But it doesn't work. I have mounted an example in JSFiddle . https://jsfiddle.net/JLLMNCHR/09qtwbL6/74/ Also here is the code: <div id="app"> <ul v-for="index in numAdjuntos" v-bind:id="index" v-bind:key="index"> <li> <label>File {{index}}</label> <input v-if="adjuntos[index

Trying to change object property and keep reactivity. Property or method “vm” is not defined on the instance but referenced during render

杀马特。学长 韩版系。学妹 提交于 2021-02-17 05:05:10
问题 Until now, I was trying to change the value of an object property to false using @click='review.isActive = true' , however, it turns out Vue cannot detect such changes which means that property won't be reactive. Based on the documentation https://vuejs.org/v2/guide/list.html#Caveats, this can be avoided by using one of the following methods: Vue.set(vm.reviews, index, true) vm.reviews.splice(index, 1, true) Sadly I get an error using either way. I assume I don't quite understand how the Vue

PATCH 405 (Method Not Allowed) VueJs

此生再无相见时 提交于 2021-02-17 04:42:20
问题 I have route in group 'prefix'=>'admin' in web.php Route::post('/slideUpdate/{id}','SlideController@postSlideUpdate') In Add.vue i call function update() in methods axios.patch(`/admin/slideUpdate/${this.list.id}`,this.$data.list) In SlideController i have function public function postSlideUpdate(Request $request,$id) { $product = Slide::find($request->id);..$product->save(); } When i click button @click="update" i get error PATCH http://minhquanbicycle.com/admin/slideUpdate/1 405 (Method Not

Migrating “slot” deprecated syntax

夙愿已清 提交于 2021-02-17 03:10:48
问题 I'm running on vue.js 2.6.1 the current code (written by a co-worker who's not around anymore) He used the 'scope' directive with the following deprecated syntax <template slot="HEAD[epc]" slot-scope="data"> <div> <p class="column-title">{{data.label}}</p> <p class="explanation-text">{{data.field.explanation}}</p> </div> </template> I want to access the slot-scope "data" prop but I want to migrate the old syntax onto a new one the documentation fails to explain how. also, I tried changing the

Migrating “slot” deprecated syntax

两盒软妹~` 提交于 2021-02-17 03:10:23
问题 I'm running on vue.js 2.6.1 the current code (written by a co-worker who's not around anymore) He used the 'scope' directive with the following deprecated syntax <template slot="HEAD[epc]" slot-scope="data"> <div> <p class="column-title">{{data.label}}</p> <p class="explanation-text">{{data.field.explanation}}</p> </div> </template> I want to access the slot-scope "data" prop but I want to migrate the old syntax onto a new one the documentation fails to explain how. also, I tried changing the

Migrating “slot” deprecated syntax

非 Y 不嫁゛ 提交于 2021-02-17 03:10:18
问题 I'm running on vue.js 2.6.1 the current code (written by a co-worker who's not around anymore) He used the 'scope' directive with the following deprecated syntax <template slot="HEAD[epc]" slot-scope="data"> <div> <p class="column-title">{{data.label}}</p> <p class="explanation-text">{{data.field.explanation}}</p> </div> </template> I want to access the slot-scope "data" prop but I want to migrate the old syntax onto a new one the documentation fails to explain how. also, I tried changing the