반응형
부에루터:TypeError: 이것._불쌍한init는 함수가 아님
Laravel 프로젝트 내에 Vue-router를 설치한 후 다음을 사용해 보십시오.
import VueRouter from 'vue-router'
Vue.use(VueRouter)
그리고 난 이걸 이해한다:
[Vue warn]: Error in beforeCreate hook: "TypeError: this._router.init is not a function"
흥미롭게도, 이전에는 모든 것이 괜찮았지만, 갑자기 이 메시지를 받기 시작했다.
대체하다vue
와 함께vue-loader
웹 팩 구성 https://github.com/vuejs/vue-loader/issues/409에서
갱신하다
좋아, 분명히 당신은 독특한 방법으로 라우터를 초기화하고 있다.아마도 당신은 단일 페이지 앱이 아닌 상태 태그 어플리케이션을 구축하고 있을 것이다.
require('./bootstrap');
import Vue from 'vue'
import VueRouter from 'vue-router'
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
let home = require('./components/Home.vue'));
let buy = require('./components/Buy.vue');
let home = require('./components/Home.vue');
let sell = require('./components/Sell.vue');
let wallet = require('./components/Wallet.vue');
const routes = [{
path: '/',
component: home
},
{
path: '/buy',
component: buy
},
{
path: '/sell',
component: sell
},
{
path: '/wallet',
component: wallet
}
];
const router = new VueRouter
({
mode: 'history',
routes
})
Vue.use(VueRouter);
window.app = new Vue({
el: '#app',
router,
render: h => h(home)
});
내 app.js는 다음과 같이 보인다.
require('./bootstrap');
window.Vue = require('vue');
import VueRouter from 'vue-router'
Vue.use(VueRouter)
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('home', require('./components/Home.vue'));
let buy = require('./components/Buy.vue');
let home = require('./components/Home.vue');
let sell = require('./components/Sell.vue');
let wallet = require('./components/Wallet.vue');
const routes = [{
path: '/',
component: home
},
{
path: '/buy',
component: buy
},
{
path: '/sell',
component: sell
},
{
path: '/wallet',
component: wallet
}
]
const router = ({
mode: 'history',
routes
})
const app = new Vue({
el: '#app',
router
});
참조URL: https://stackoverflow.com/questions/51462715/vue-router-typeerror-this-router-init-is-not-a-function
반응형
'Programing' 카테고리의 다른 글
로컬 컴퓨터 또는 웹 리소스에서 이미지 또는 그림을 주피터 노트북에 내장하는 방법 (0) | 2022.03.24 |
---|---|
페이지의 전체 내용을 변경하는 방법 (0) | 2022.03.24 |
Vue.js에서 어레이 정렬 (0) | 2022.03.24 |
rxjs로 최종과 최종의 차이점 (0) | 2022.03.24 |
반응성에 .gitignore 권장 (0) | 2022.03.24 |