-
-
Count: {{ counter }}
-
-
-
-
-
-
diff --git a/src/utils/index.js b/src/utils/index.js
index 9657c9c..00f5ef7 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -35,7 +35,11 @@ export function parseTime(time, cFormat) {
}
export function formatTime(time, option) {
- time = +time * 1000
+ if (('' + time).length === 10) {
+ time = parseInt(time) * 1000
+ } else {
+ time = +time
+ }
const d = new Date(time)
const now = Date.now()
diff --git a/tests/unit/components/Breadcrumb.spec.js b/tests/unit/components/Breadcrumb.spec.js
index 5b63d0e..3ec37bb 100644
--- a/tests/unit/components/Breadcrumb.spec.js
+++ b/tests/unit/components/Breadcrumb.spec.js
@@ -1,24 +1,103 @@
-// import { shallowMount } from '@vue/test-utils'
-// import Breadcrumb from '@/components/Breadcrumb.vue'
+import { mount, createLocalVue } from '@vue/test-utils'
+import VueRouter from 'vue-router'
+import ElementUI from 'element-ui'
+import Breadcrumb from '@/components/Breadcrumb/index.vue'
-// describe('Breadcrumb.vue', () => {
-// const wrapper = shallowMount(Breadcrumb)
+const localVue = createLocalVue()
+localVue.use(VueRouter)
+localVue.use(ElementUI)
-// it('toggle', () => {
-// expect(wrapper.vm.counter).toBe(0)
-// wrapper.find('[jest="increment-button"]').trigger('click')
-// expect(wrapper.vm.counter).toBe(1)
-// })
+const routes = [
+ {
+ path: '/',
+ name: 'home',
+ children: [{
+ path: 'dashboard',
+ name: 'dashboard'
+ }]
+ },
+ {
+ path: '/menu',
+ name: 'menu',
+ children: [{
+ path: 'menu1',
+ name: 'menu1',
+ meta: { title: 'menu1' },
+ children: [{
+ path: 'menu1-1',
+ name: 'menu1-1',
+ meta: { title: 'menu1-1' }
+ },
+ {
+ path: 'menu1-2',
+ name: 'menu1-2',
+ redirect: 'noredirect',
+ meta: { title: 'menu1-2' },
+ children: [{
+ path: 'menu1-2-1',
+ name: 'menu1-2-1',
+ meta: { title: 'menu1-2-1' }
+ },
+ {
+ path: 'menu1-2-2',
+ name: 'menu1-2-2'
+ }]
+ }]
+ }]
+ }]
-// // it('渲染正确', () => {
-// // expect(wrapper.html()).toContain('