Apollo is not assignable to parameter of type ‘VueClass

The syntax for the “apollo” options you listed do indeed look correct- assuming you’re intending to use the package “vue-apollo” to work with Apollo. If you’re getting this error it may mean that “vue-apollo” hasn’t been installed, or there’s some problem with the installation. If you look in the Vue Chrome debugger tool on one … Read more

How to dynamically mutate “args” in Storybook v6 from the component’s action?

I had the same exact issue, and kept looking for days, till I stumbled upon this github post: https://github.com/storybookjs/storybook/issues/12006 Currently in my React (am sure vue approach will be similar), I do following: import React from ‘react’; import CheckboxGroupElement from ‘../CheckboxGroup’; import { STORYBOOK_CATEGORIES } from ‘elements/storybook.categories’; import { useArgs } from ‘@storybook/preview-api’; export default … Read more

How is the correct way to work with Vuex and typescript?

Vuex is perfectly compatible with typescript using these vuex imports: import {GetterTree, MutationTree, ActionTree} from “vuex” The example below shows the easiest and most complete way to use vuex in typescript. Principal store file: import Vue from ‘vue’ import Vuex from ‘vuex’ import { GetterTree, MutationTree, ActionTree } from “vuex” import MySubModule from ‘@/store/submodule’ Vue.use(Vuex) … Read more

vue.js v-for list not updating

Array change detection is a bit tricky in Vue. Most of the in place array methods are working as expected (i.e. doing a splice in your $data.names array would work), but assigining values directly (i.e. $data.names[0] = ‘Joe’) would not update the reactively rendered components. Depending on how you process the server side results you … Read more

How do I upload image in vuejs?

I think in your case you are looking for a solution like this example: uploading a image and previewing it before submission <template> <div> <img src:”previewImage” class=”uploading-image” /> <input type=”file” accept=”image/jpeg” @change=uploadImage> </div> </template> <script> export default { name:’imageUpload’, data(){ return{ previewImage:null } }, methods:{ uploadImage(e){ const image = e.target.files[0]; const reader = new FileReader(); … Read more

‘v-model’ directives cannot update the iteration variable itself

My solution was very simple (see v-model=”tags[index]”): Instead of doing this: <template v-for=”tag in tags”> <TagView :key=”tag.key” v-model=”tag” /> </template> You should do this: <template v-for=”(tag, index) in tags”> <TagView :key=”tag.key” v-model=”tags[index]” /> </template> The reason is you cannot pass iterated object tag into v-model for modifications. Please find more info about this: Iterating a … Read more