I was thinking about this, but in this case, the auto-import feature is lost, so i need import component globally, or in every place.
Also I need use my names for components. And I finally - lost Vetur autocompletion in templates
Latest posts made by Fragster
-
RE: Is there proper way to set default values to component props?
-
RE: Is there proper way to set default values to component props?
My fault! interference with other components with same props. E.g. fab has ‘square’ prop, but i want to set default only for q-filed and q-input. Or no-caps only for buttons, not for q-tabs. Is there some way to configure default values for props for definite component?
(sorry for bad english)
-
Is there proper way to set default values to component props?
e.g. I want to set default no-caps for all q-btn, q-tabs (and everywhere), i can use dirty hack with global mixin in boot file:
export default function ({ Vue }) { const strategies = Vue.config.optionMergeStrategies strategies.props = function (parent, child) { const result = { ...parent, ...child } if (parent?.noCaps) { result.noCaps = parent.noCaps } return result } Vue.mixin({ props: { noCaps: { type: Boolean, default: true } } }) // strategies.props = strategies.methods }
but what if I want to set all my q-input and q-field “square filled” without interference with q-card?
-
How to use vuex store without access to vue instance?
E.g in beforeRouteEnter hook?
I try make it in this way (store is dynamically filled in boot folder):import StoreFunction from 'store'; const store = StoreFunction(); ... export default { beforeRouteEnter(to, from, next) { if (store.state.catalog.loading) next({to: 'routename'}); else next(); }
but it causes an error “do not mutate vuex store state outside mutation handlers.”
to fix it, I change
store/index.js
to return store instance instead of function, and it works. But I’m worrying about possible side effects of this ‘fix’.//export default function(/* { ssrContext } */) { export default new Vuex.Store({
Is this right fix, or there is another ‘proper’ way in my case?