I want to transform the example string “0.45*100” in a value (45). Another example, if I have two variables totalCost and contractVolume, and I have the string “totalCost * 1000 / contractVolume”: how can I transform the string in the resulting value? ex. Obs: I see a similar question, but in php, in the example he uses the method eval()
Tag: vue.js
How to make an array of objects from object array in vueJs?
I have an Object array which is following But, I need to show email: Email muss eine ….. phone: Telefonnummer ist … How can I do this in javascript? Actually I need to use this in VueJs. Answer From the screenshot you are receiving this from props so we can do this in the template: If you would like to
Vue: Using Vuex store in beforeRouteEnter hook to cancel navigation
I am trying to get vue-router to check a list of permissions, before finishing the navigation to a new route. The permissions are stored in vuex and ideally I’d want to avoid passing them as props everywhere. When I use the next(vm => {}) callback, regardless of the outcome, it routes to next page, even though it should receive false
Two of my routes are extremely similar, to the point that I copy-pasted most of the stuff. I assume I need to DRY the code but I’m not sure how
I have an admin panel route with 2 nested child routes that render 2 views – AdminBrands renders brands and allow the admin to see and delete brands, and AdminCategories where the admin can see and delete categories. Now the problem is that those 2 views are super similar to each other, but at the same time they have got
NuxtJs dynamic open graph tags are not working
i am trying to set up a dynamic open graph meta tags using the following code I have logged postDetails and the data is there in asyncData function. Now when i open the page and inspect the meta tags are perfectly changed, but when i open facebook and paste in it or press ctrl + u it only shows its
VueJS – Display Countdown of setInterval function
I have a function being triggered within mounted, and then it gets called every 15 minutes after that. In my component I want to display a countdown until the next setInterval in minutes/seconds. How am I able to repeatedly countdown the time until the next setInterval runs? Answer in pullData function create new interval and add leftTime = 900000 field
‘google’ is not defined Using Google Maps JavaScript API Loader
I have a Vue CLI project that uses the Google Maps JavaScript API Loader. I import the loader using the code below: After that, I defined the loader, like so: Now, when I try to display a map using the google.maps.Map object, I get an error stating that ‘google’ is not defined. All the code above is in the project’s
Pass events easily from a child component to a parent in Vue 2
I have a base component BaseInput.vue which accepts attributes and emits events. It’s easy to bind all attributes by using v-bind=”$attrs” instruction. Next I have a wrapper component WrapInput.vue which passes attributes to BasicInput and emits events. My question: is there a handy way in Vue to pass a bunch of events in “proxy” components without the need to list
Not understanding payload in update action
I am having trouble understanding in how will the payload look in the first action. Why in the first one there is { } and … , what does that give? How do I pass data into it, when I call it from a component? In the second one, i would just pass an object, but I don’t get the
SPA content refresh with constant updating
I know that recommended approach to updating SPA versions is to use service workers and alert user that he should refresh page. But what options do we have when there’s lots of pages and new things constantly getting added? I believe this would annoy a lot of users especially when those updates aren’t even related to the page they are