How to call a method from a callback defined in data() in Vue 2.7?

I use a 3rd party component called HelloWorld. The component accepts a prop called closeCallbacks. It is an array of callbacks that are called when the HelloWorld component is closed. I can not change the way the 3rd party component works. I implement the template of my component to use HelloWorld component and pass closeCallbacks… Read More How to call a method from a callback defined in data() in Vue 2.7?

:class bind with multiple arguments

I’m trying to add a class to my bind however im getting an error on the "+ animation" its saying : is expected, how do i go about getting that class class="animation__placeholder" :class="{ ‘animation__placeholder–‘ + animation, ‘animation__placeholder–top’:(alignment === ‘top’), ‘animation__placeholder–center’:(alignment === ‘center’), ‘animation__placeholder–bottom’:(alignment === ‘bottom’), ‘animation__placeholder–right’:(side === ‘right’), ‘animation__placeholder–center’:(side === ‘center’), ‘animation__placeholder–left’:(side === ‘left’), }"… Read More :class bind with multiple arguments

Navigation guard for dynamic route

I have navigation guards to prevent visitors from viewing protected pages without being logged in. One of the pages I want them to see without login is a dynamic route e.g. example.com/dynamic_part. Below is my vuejs code: router.beforeEach((to, from, next) => { let token = window.sessionStorage.getItem("local_token"); let whitelist = [ "/", "/register", "/login", "/dynamic_part/", ];… Read More Navigation guard for dynamic route

Vue2 run serve syntax error … Unexpected token

I created a small test app using vue-diagram-editor from https://github.com/max-kut/vue-diagram-editor. That worked no problem so wanted to install it into my main vue app, which was running fine beforehand. $ npm install –save vue-diagram-editor … ok installed. $ npm run serve INFO Starting development server… 98% after emitting CopyPlugin ERROR Failed to compile with 2… Read More Vue2 run serve syntax error … Unexpected token

Vue setFieldValue sorting based on keys on its own

I’ve this function I use to upload from csv and save the details in an array and save it getArray(row) { let getDetail = [] if (row[‘comment’].trim().length > 0) { this.setFieldValue(getDetail, ‘Comments’, row[‘comment’]) } if (row[‘start’].trim().length > 0) { this.setFieldValue(getDetail, ‘Start Date’, this.dateFormat(row[‘start’])) } if (row[‘end’].trim().length > 0) { this.setFieldValue(getDetail, ‘End Date’, this.dateFormat(row[‘end’])) } return… Read More Vue setFieldValue sorting based on keys on its own

Vue – Emit Child to parent

In a vue2 application i need to send a value from a child to the parent. I try something like this Child function goTo(id: string) { this.$emit(‘goToSpots’, id) }, Parent Component <Main class="px-5" @goToSpots="goToSpots()" /> Parent function goToSpots(id: string) { this.selected = id }, The problem: this.selected returns undefined, can’t get param properly. The question… Read More Vue – Emit Child to parent

invalid expression: Unexpected token '.' in raw expression

<b-field label="Username" :type="{ ‘is-danger’: Boolean(form.errors.username[0]) }" :message="{ form.errors.username[0]: Boolean(form.errors.username[0]) }"> <b-input v-model="form.values.username" placeholder="Username"></b-input> </b-field> This is giving me this error: Errors compiling template: invalid expression: Unexpected token ‘.’ in { form.errors.username[0]: Boolean(form.errors.username[0]) } Raw expression: :message="{ form.errors.username[0]: Boolean(form.errors.username[0]) }" I am new to Vue and have been stuck on this problem. Can anyone please help?… Read More invalid expression: Unexpected token '.' in raw expression