Skip to content
Advertisement

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 updates the

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-fetch-and-compile-a-template-with-nuxt

Validating Vue syntax with W3C Validator

I’m doing this course where I can freely select a framework to build a simple application. However, we are to validate the HTML with the W3C validator. I have no idea how. The W3C validator does not support Vue-specific stuff. Errors such as: Is everywhere. And this is just for one line of code. Am I doing something wrong, or

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, itemsDelegates still contains all entries. Where is my thinking error here? Answer filter returns

How do I access another field using vuelidate

I’m making some validators on a form for shipping using vuelidate. Currently I’m checcking if the postalCode is in the right format. This field is dependent on the country field though (because different countries have different postal code formats. I’m having trouble accessing the viewmodel itself though, and I don’t get the explanation in vuelidates docs. Currently I’m working with

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, while the one inside computed returns the actual user. Why it’s

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 advance Answer

Advertisement