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
Tag: vue.js
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 to text wrap to next line in Vuetify when class text-wrap not working?
I have cards that cut off words, moving them to a new line: I tried to use class=”text-wrap”, but it doesn’t work: Answer Thanks to @Chin.Udara solution is: <v-card-title style=”word-break: break-word”…
toggle the value of variable that is being watched in vuejs
I have a data variable whose typeof is boolean and I have put this in watch hook. On changing the value to true , I’m performing some tasks in watch like this and it’s working perfectly. Then I started to integrate some other stuff and requirement is to toggle the variable in case if it’s already true because i want
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
Loop in NuxtJS (Vue) outputs wrong data
I have the following data: my loop does the following: and outputs only: but (the loop above) should output all data for both languages, right? Also, how can i choose language (statically or dynamically)? Answer You should make two loops and render the selected language conditionally using v-if :
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