Skip to content

Tag: vue.js

Best place to fetch data for authed users in Vue app?

Hi I’m fetching a arrays of posts from my express API in the Home.vue which is protected by route guards. fetchPosts action: In my action I commit a mutation which sets the posts object to res.data. I only want to fetchPosts when user logs in since I have a mutation which adds the post to the db and upd…

Vuejs how to use dynamical template in component?

I want to render a custom component which has a dynamical template base on user input. when user input a specific string ([:component-1]), it will be render as a component (CustomComponent) how to achieve this? Thanks a lot for anyone help! Answer I figured it out by using Vue.complie according to dynamically…

Vue Filter one array by an other array

Good morning, I have an array that looks like this: Let’s just call it itemsDelegates. And then I have this one: Now let’s call this addressvisibility. Now I’m trying to remove from itemsDelegates all entries that are already in addressvisibility. I tried the following approach: Nevertheless…

Vuejs – cannot access $root data from component

I’m using vue.js to manage the user and I have this piece of code to initialize vue: Inside store I have: In this way, the user is correctly initialized. Now, I have also a vue component with the following: But the console.log(this.$root.store.user.state.user) inside the init() method results in null, w…

Open modal when click on button

I have this code : SepaModal : I have the error : Error in v-on handler: “TypeError: this.$refs.sepaModal.open is not a function”. I tried with this.$refs.sepaModal.show(); (the same error). Very strange bacause I put a console.log and I have sepaModal in refs. Can you help me please ? Thx in adva…