Category : vue.js

How to remove sorting from this script part: getFirstAvailablePeriod() { const sortedPeriods = this.periods.sort((a: IPeriod, b: IPeriod) => { if (a.default_price.price === b.default_price.price) { return 0; } return (a.default_price.price > b.default_price.price) ? 1 : -1; }).filter((period: IPeriod) => !period.locked); const alreadySelected: IPeriod = sortedPeriods.find((period: IPeriod) => period.id === this.value); if (alreadySelected) { return alreadySelected; } ..

Read more

What I want to come true I used inject in Nuxt.js but I get an error. I want to use the same function in Vuex and Components. #Code VueFile template <template v-if="selectedBook != null"> <v-row style="text-align:center;"> <v-col cols="6" class="pa-5"> <img :src="image(selectedBook)"> // inject image </v-col> <v-col cols="4" class="pa-5"> <v-card-title>{{ title(selectedBook) }}</v-card-title> // inject title <v-card-subtitle ..

Read more

I am trying to remove special character form my text. I have text like "People don’t always obey God because they have to disobey God." I converted using this code: removeSpecialCharacter(str) { return str.replace(/[^a-zA-Z ]/g, ""); }, <label>{{ removeSpecialCharacter(choice.choice) }}</label> but i got output like: "People dont always obey God because they have to disobey ..

Read more

I’m using Tipap text editor in my Nuxt project. I can pass the initial content (in components/blogs/Editor.vue) to another component (in pages/blogs/editor.vue), however when the data is updated, the initial content that is being passed won’t update. It keeps getting the same data. Here is my code: in components/blogs/Editor.vue <script> // import the component and ..

Read more

I decided to start understanding vue 3 here(try to create something). But the problem is not how I can’t make global variables so that I can take data in any component. Here’s what happened let app = Vue.createApp({ data() { return { info: Object } }, methods:{ async loadInfo() { const {data} = await this.axios.get(‘/api/load/info’).then((response) ..

Read more