vendredi 19 janvier 2018

Vue

In my .vue file within my I have:

<a v-bind:href="'javascript:artist(\'' + _.escape(artist) + '\')'">

which is using the Lodash function _.escape. This generates a string of errors the first of which is:

[Vue warn]: Property or method "_" is not defined on the instance but referenced during 
render.

However in the same file in my section of the component I am happily and successfully using a range of Lodash functions.

This is a Laravel app and in my app.js file I have this code:

require('./bootstrap');

window.Vue = require('vue');
import VueRouter from 'vue-router';

window.Vue.use(VueRouter);

import lodash from 'lodash';
Object.defineProperty(Vue.prototype, '$lodash', { value: lodash });

import SearchHome from './components/search.vue';

const routes = [
{
    path: '/',
    components: {
        searchHome: SearchHome
    }
},

]

const router = new VueRouter({ routes })

const app = new Vue({ router }).$mount('#app')

Can anyone please help me?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2Bf0QiS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire