반응형
VueJS에서 테스트를 실행할 때 오류 발생: 경로 탐색 중 검색되지 않은 오류
템플릿에 라우터 구성 요소가 있을 때마다 장치 테스트에서 이 경고가 계속 표시됨:
알 수 없는 사용자 정의 요소 이전에 이 문제에 대한 티켓을 한 장 올렸으며, 같은 시도를 했지만 운이 따르지 않았다.이 오류에 대해 좀 더 알고 있는 사람이 있을까?
FinalCountdown.html
<div id="c-final-countdown">
<h1>Hello App!</h1>
<p>
<!-- use router-link component for navigation. -->
<!-- specify the link by passing the `to` prop. -->
<!-- <router-link> will be rendered as an `<a>` tag by default -->
<router-link to="/foo">Go to Foo</router-link>
<router-link to="/bar">Go to Bar</router-link>
</p>
</div>
FinalCountdown.spec.js
import Vue from 'vue'
import router from '../../router'
import FinalCountdown from 'src/components/workflow/FinalCountdown'
describe('workflow/FinalCoundDown component.'), () => {
const getComponent = (date) => {
let vm = new Vue({
template: '<div><final-countdown ref="component"></final-countdown></div>',
components: {
FinalCountdown
}
})
return vm
}
it('Should render correctly with a date in the future.', () => {
const tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
const vm = getComponent().$mount()
const component = vm.$refs.component
expect(vm.$el).toBeTruthy()
console.log(vm.$el) // <div><!----></div>
})
}
우리의 주장은 우리가 제공해야만 하기 때문에 실패한다.vm
을 예로 들다.VueRouter
인스턴스그래서 그때getComponent
다음이 됨:
const getComponent = (date) => {
Vue.use(vueRouter)
const routes = { ... };
const router = new VueRouter({ routes })
let vm = new Vue({
router,
template: '<div><final-countdown ref="component"></final-countdown></div>',
components: {
FinalCountdown
}
})
return vm
}
그리고 나서 부품 마운팅을 볼 수 있는데 경고 오류가 발생했어.모든 것이 이치에 맞기를 바란다:d
WARN LOG: '[vue-router] uncaught error during route navigation:'
반응형
'programing' 카테고리의 다른 글
오류 'CR' 더 예쁘거나 예쁜 Visual Studio 코드 삭제 (0) | 2022.04.19 |
---|---|
Vue - 외부 제어를 기반으로 동적으로 활성화하는 방법 (0) | 2022.04.19 |
Vuex 저장소에 올바르게 추가할 수 없음 (0) | 2022.04.19 |
vue js로 div graggable을 만드는 방법? (0) | 2022.04.19 |
ArrayList의 초기 크기 (0) | 2022.04.19 |