![](/style/images/good.png)
14
![](/style/images/bad.png)
求大佬看看 laravel 使用 jetsteam (inertiajs) vue 的一个报错:app.js:63329 Uncaug...
source link: https://www.oschina.net/question/272738_2320722
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
求大佬看看 laravel 使用 jetsteam (inertiajs) vue 的一个报错:app.js:63329 Uncaught ReferenceError: route is not defined
# resource/js/app.js
require('./bootstrap');
require('moment');
// Vue.config.productionTip = false
import Vue from 'vue';
import { InertiaApp } from '@inertiajs/inertia-vue';
import { InertiaForm } from 'laravel-jetstream';
import PortalVue from 'portal-vue';
import App from './sample/demo1.vue';
Vue.use(InertiaApp);
Vue.use(InertiaForm);
Vue.use(PortalVue);
Vue.mixin({
methods: {
route: route
}
});
const app0 = new Vue({
el: '#app0',
data: {
num: 0,
msg: 'this is app0',
myHtml: '<h3>This is myHtml</h3>',
keyClickUsername: '',
keyClickPassword: '',
myUrl: 'http://www.mydomain.com',
isActive1: true,
isActive2: false,
myClassName3: 'cls3',
myClassName4: 'cls4',
hasMyClassName5: true,
myClassArr: ['myClass1', 'myClass2'],
myClassObj: {
'myClass3':true
},
myColor: 'red',
myFontSize: '3em',
originStyles: { 'font-size': '2em' },
overrideStyles: { 'font-size': '4em' }
},
methods: {
addNum: function(event) {
console.log(event.target.tagName)
},
multiplyNum: function (step1 = 1, step2 = 2, event) {
this.num += step1 * step2
console.log(event.target.tagName + event.target.innerHTML)
},
doLink1: function () {
console.log('doLink1')
},
doLink2: function () {
console.log('doLink2')
},
doKeyClick: function () {
console.log('doKeyClick')
}
}
});
const app1 = new Vue({
el: '#app1',
components: { App }
});
const app = document.getElementById('app');
new Vue({
render: (h) =>
h(InertiaApp, {
props: {
initialPage: JSON.parse(app.dataset.page),
resolveComponent: (name) => require(`./Pages/${name}`).default,
},
}),
}).$mount(app);
报了这个错:
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK