2019-09-04 21:56:58 +08:00
|
|
|
import Vue from 'vue/dist/vue'
|
|
|
|
import VueRouter from 'vue-router'
|
|
|
|
import '../styles/index.scss'
|
|
|
|
import 'codemirror/lib/codemirror.css'
|
2019-09-23 15:04:57 +08:00
|
|
|
import './styles/atom-one-dark-reasonable.scss'
|
|
|
|
import './styles/atom-one-light.scss'
|
|
|
|
import './styles/markdown.scss'
|
2019-09-25 12:19:57 +08:00
|
|
|
import './styles/font.scss'
|
2019-09-04 21:56:58 +08:00
|
|
|
import NaiveUI from '../index'
|
|
|
|
import SourceBlock from './SourceBlock'
|
2019-09-21 17:03:37 +08:00
|
|
|
import VueI18n from 'vue-i18n'
|
2019-10-10 22:38:29 +08:00
|
|
|
|
|
|
|
import intro from './documentation/intro/intro'
|
|
|
|
import start from './documentation/intro/start'
|
|
|
|
import devGuildlines from './documentation/intro/devGuidelines'
|
|
|
|
import status from './documentation/intro/status'
|
|
|
|
|
2019-09-23 19:14:15 +08:00
|
|
|
import nimbusServiceLayoutDemo from './documentation/components/nimbusServiceLayoutDemo'
|
|
|
|
import homeDemo from './documentation/components/homeDemo'
|
2019-10-16 23:20:40 +08:00
|
|
|
import gradientText from './documentation/components/gradientText'
|
2019-09-23 19:14:15 +08:00
|
|
|
import iconDemo from './documentation/components/iconDemo'
|
2019-10-11 17:01:23 +08:00
|
|
|
import checkbox from './documentation/components/checkbox'
|
2019-10-12 16:15:20 +08:00
|
|
|
import button from './documentation/components/button'
|
2019-09-29 19:07:16 +08:00
|
|
|
import switchDemo from './documentation/components/switch'
|
2019-09-23 19:14:15 +08:00
|
|
|
import tableDemo from './documentation/components/tableDemo'
|
2019-10-10 14:30:36 +08:00
|
|
|
import input from './documentation/components/input'
|
2019-10-18 16:45:40 +08:00
|
|
|
import select from './documentation/components/select'
|
2019-09-23 19:14:15 +08:00
|
|
|
import cascaderDemo from './documentation/components/cascaderDemo'
|
|
|
|
import inputKeyValuePairsDemo from './documentation/components/inputKeyValuePairsDemo'
|
2019-09-29 00:13:01 +08:00
|
|
|
import modal from './documentation/components/modal'
|
2019-09-23 19:14:15 +08:00
|
|
|
import nimbusFormCardDemo from './documentation/components/nimbusFormCardDemo'
|
2019-10-08 13:34:34 +08:00
|
|
|
import message from './documentation/components/message'
|
2019-09-28 13:47:54 +08:00
|
|
|
import tooltip from './documentation/components/tooltip'
|
2019-09-27 22:28:25 +08:00
|
|
|
import popover from './documentation/components/popover'
|
2019-10-11 19:04:22 +08:00
|
|
|
import alert from './documentation/components/alert'
|
2019-10-15 14:55:05 +08:00
|
|
|
import datePicker from './documentation/components/datePicker'
|
2019-09-23 19:14:15 +08:00
|
|
|
import inputNumberDemo from './documentation/components/inputNumberDemo'
|
|
|
|
import nimbusIconDemo from './documentation/components/nimbusIconDemo'
|
|
|
|
import radioDemo from './documentation/components/radioDemo'
|
|
|
|
import formDemo from './documentation/components/formDemo'
|
|
|
|
import tabsDemo from './documentation/components/tabsDemo'
|
2019-10-17 23:16:38 +08:00
|
|
|
import timePicker from './documentation/components/timePicker'
|
2019-09-28 18:50:56 +08:00
|
|
|
import confirm from './documentation/components/confirm'
|
2019-09-23 19:14:15 +08:00
|
|
|
import backTopDemo from './documentation/components/backTopDemo'
|
|
|
|
import dropdownDemo from './documentation/components/dropdownDemo'
|
2019-09-04 21:56:58 +08:00
|
|
|
import scrollbarDebug from './debugComponents/scrollbarDebug'
|
|
|
|
import scrollbarDebug2 from './debugComponents/scrollbarDebug2'
|
2019-10-08 19:06:23 +08:00
|
|
|
import badge from './documentation/components/badge'
|
2019-09-23 19:14:15 +08:00
|
|
|
import stepsDemo from './documentation/components/stepsDemo'
|
2019-10-16 23:28:36 +08:00
|
|
|
import notification from './documentation/components/notification'
|
2019-09-23 19:14:15 +08:00
|
|
|
import nimbusConfirmCardDemo from './documentation/components/nimbusConfirmCardDemo'
|
2019-10-12 23:55:50 +08:00
|
|
|
import pagination from './documentation/components/pagination'
|
2019-10-11 19:04:22 +08:00
|
|
|
import collapse from './documentation/components/collapse'
|
2019-09-27 22:28:25 +08:00
|
|
|
import tag from './documentation/components/tag'
|
2019-09-23 19:14:15 +08:00
|
|
|
import timelineDemo from './documentation/components/timelineDemo'
|
2019-10-18 16:45:40 +08:00
|
|
|
import progress from './documentation/components/progress'
|
2019-10-12 19:08:11 +08:00
|
|
|
import divider from './documentation/components/divider'
|
2019-09-23 19:14:15 +08:00
|
|
|
import popconfirmDemo from './documentation/components/popconfirmDemo'
|
2019-10-12 23:22:52 +08:00
|
|
|
import anchor from './documentation/components/anchor'
|
2019-10-18 11:23:45 +08:00
|
|
|
import popselect from './documentation/components/popselect'
|
2019-10-12 15:46:02 +08:00
|
|
|
import app from './documentation/components/app'
|
2019-10-15 18:55:57 +08:00
|
|
|
import advancedTable from './documentation/components/advancedTable'
|
2019-09-23 19:14:15 +08:00
|
|
|
import transferDemo from './documentation/components/transferDemo'
|
2019-10-15 18:01:18 +08:00
|
|
|
import spin from './documentation/components/spin'
|
2019-09-23 19:14:15 +08:00
|
|
|
import drawerDemo from './documentation/components/drawerDemo'
|
2019-10-08 14:14:30 +08:00
|
|
|
import loadingBar from './documentation/components/loadingBar'
|
2019-09-23 19:14:15 +08:00
|
|
|
import timeDemo from './documentation/components/timeDemo'
|
|
|
|
import sliderDemo from './documentation/components/sliderDemo'
|
|
|
|
import treeDemo from './documentation/components/treeDemo'
|
2019-10-13 20:16:43 +08:00
|
|
|
import affix from './documentation/components/affix'
|
2019-09-04 21:56:58 +08:00
|
|
|
|
|
|
|
import demo from './demo'
|
2019-09-23 15:04:57 +08:00
|
|
|
import ComponentDemo from './utils/ComponentDemo'
|
|
|
|
import ComponentDemos from './utils/ComponentDemos'
|
|
|
|
import ComponentDocumentation from './utils/ComponentDocumentation'
|
|
|
|
import DocumentationWrapper from './utils/DocumentationWrapper'
|
|
|
|
import './styles/ComponentDemo.scss'
|
2019-09-28 18:50:56 +08:00
|
|
|
import './styles/demo.scss'
|
2019-09-04 21:56:58 +08:00
|
|
|
|
|
|
|
import popoverDebug from './debugComponents/popoverDebug'
|
|
|
|
import routerDebug from './debugComponents/routerDebug'
|
|
|
|
import modalDebug from './debugComponents/modalDebug'
|
|
|
|
import datePickerDebug from './debugComponents/datePickerDebug'
|
|
|
|
import backTopDebug from './debugComponents/backTopDebug'
|
|
|
|
import cancelMarkDebug from './debugComponents/cancelMarkDebug'
|
|
|
|
import cascaderDebug from './debugComponents/cascaderDebug'
|
2019-09-12 11:58:46 +08:00
|
|
|
import verticalAlignDebug from './debugComponents/verticalAlignDebug'
|
2019-09-04 21:56:58 +08:00
|
|
|
|
2019-09-21 17:03:37 +08:00
|
|
|
Vue.use(VueI18n)
|
2019-09-04 21:56:58 +08:00
|
|
|
Vue.use(VueRouter)
|
2019-09-21 17:03:37 +08:00
|
|
|
Vue.use(NaiveUI)
|
|
|
|
|
|
|
|
const i18n = new VueI18n({
|
|
|
|
locale: 'en-us'
|
|
|
|
})
|
2019-09-04 21:56:58 +08:00
|
|
|
|
|
|
|
Vue.component(SourceBlock.name, SourceBlock)
|
2019-09-23 15:04:57 +08:00
|
|
|
Vue.component('ComponentDemo', ComponentDemo)
|
2019-09-21 17:03:37 +08:00
|
|
|
Vue.component('ComponentDemos', ComponentDemos)
|
|
|
|
Vue.component('DocumentationWrapper', DocumentationWrapper)
|
|
|
|
Vue.component('ComponentDocumentation', ComponentDocumentation)
|
2019-09-04 21:56:58 +08:00
|
|
|
|
2019-09-24 16:59:07 +08:00
|
|
|
const withPrefix = (prefix, routes) =>
|
|
|
|
routes.map((route) => {
|
|
|
|
route.path = prefix + route.path
|
|
|
|
return route
|
|
|
|
})
|
|
|
|
|
2019-09-04 21:56:58 +08:00
|
|
|
const routes = [
|
|
|
|
{
|
|
|
|
path: '/home-demo',
|
|
|
|
component: homeDemo
|
|
|
|
},
|
|
|
|
{
|
2019-09-27 22:28:25 +08:00
|
|
|
path: '/:lang/:theme/n-popover-debug',
|
2019-09-04 21:56:58 +08:00
|
|
|
component: popoverDebug
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/n-back-top-debug',
|
|
|
|
component: backTopDebug
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/n-cascader-debug',
|
|
|
|
component: cascaderDebug
|
|
|
|
},
|
|
|
|
{
|
2019-09-27 16:02:06 +08:00
|
|
|
path: '/:lang/:theme/start',
|
2019-09-04 21:56:58 +08:00
|
|
|
component: demo,
|
2019-09-27 16:02:06 +08:00
|
|
|
children: withPrefix('/:lang/:theme', [
|
2019-10-10 22:38:29 +08:00
|
|
|
{ path: '/intro', component: intro },
|
|
|
|
{ path: '/start', component: start },
|
|
|
|
{ path: '/dev-guildlines', component: devGuildlines },
|
|
|
|
{ path: '/status', component: status },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-nimbus-service-layout', component: nimbusServiceLayoutDemo },
|
|
|
|
{ path: '/n-nimbus-home-layout', component: homeDemo },
|
2019-10-16 23:20:40 +08:00
|
|
|
{ path: '/n-gradient-text', component: gradientText },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-icon', component: iconDemo },
|
2019-10-11 17:01:23 +08:00
|
|
|
{ path: '/n-checkbox', component: checkbox },
|
2019-10-12 16:15:20 +08:00
|
|
|
{ path: '/n-button', component: button },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-switch', component: switchDemo },
|
|
|
|
{ path: '/n-table', component: tableDemo },
|
2019-10-15 18:55:57 +08:00
|
|
|
{ path: '/n-advance-table', component: advancedTable },
|
2019-10-10 14:30:36 +08:00
|
|
|
{ path: '/n-input', component: input },
|
2019-10-18 16:45:40 +08:00
|
|
|
{ path: '/n-select', component: select },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-cascader', component: cascaderDemo },
|
|
|
|
{ path: '/n-InputKeyValuePairs', component: inputKeyValuePairsDemo },
|
2019-09-29 00:13:01 +08:00
|
|
|
{ path: '/n-modal', component: modal },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-nimbus-form-card', component: nimbusFormCardDemo },
|
2019-10-08 13:34:34 +08:00
|
|
|
{ path: '/n-message', component: message },
|
2019-09-28 13:47:54 +08:00
|
|
|
{ path: '/n-tooltip', component: tooltip },
|
2019-09-27 22:28:25 +08:00
|
|
|
{ path: '/n-popover', component: popover },
|
2019-10-16 23:28:36 +08:00
|
|
|
{ path: '/n-notification', component: notification },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-nimbus-confirm-card', component: nimbusConfirmCardDemo },
|
2019-10-12 23:55:50 +08:00
|
|
|
{ path: '/n-pagination', component: pagination },
|
2019-10-11 19:04:22 +08:00
|
|
|
{ path: '/n-alert', component: alert },
|
2019-10-15 14:55:05 +08:00
|
|
|
{ path: '/n-date-picker', component: datePicker },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-input-number', component: inputNumberDemo },
|
|
|
|
{ path: '/n-nimbus-icon', component: nimbusIconDemo },
|
|
|
|
{ path: '/n-radio', component: radioDemo },
|
|
|
|
{ path: '/n-form', component: formDemo },
|
|
|
|
{ path: '/n-tabs', component: tabsDemo },
|
2019-10-17 23:16:38 +08:00
|
|
|
{ path: '/n-time-picker', component: timePicker },
|
2019-09-28 18:50:56 +08:00
|
|
|
{ path: '/n-confirm', component: confirm },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-router-debug', component: routerDebug },
|
|
|
|
{ path: '/n-modal-debug', component: modalDebug },
|
|
|
|
{ path: '/n-scrollbar-debug', component: scrollbarDebug },
|
2019-10-08 19:06:23 +08:00
|
|
|
{ path: '/n-badge', component: badge },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-steps', component: stepsDemo },
|
2019-10-11 19:04:22 +08:00
|
|
|
{ path: '/n-collapse', component: collapse },
|
2019-10-18 16:45:40 +08:00
|
|
|
{ path: '/n-progress', component: progress },
|
2019-09-27 22:28:25 +08:00
|
|
|
{ path: '/n-tag', component: tag },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-timeline', component: timelineDemo },
|
|
|
|
{ path: '/n-scrollbar-debug2', component: scrollbarDebug2 },
|
|
|
|
{ path: '/n-back-top', component: backTopDemo },
|
|
|
|
{ path: '/n-date-picker-debug', component: datePickerDebug },
|
2019-10-12 19:08:11 +08:00
|
|
|
{ path: '/n-divider', component: divider },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-popconfirm', component: popconfirmDemo },
|
2019-10-12 23:22:52 +08:00
|
|
|
{ path: '/n-anchor', component: anchor },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-dropdown', component: dropdownDemo },
|
2019-10-18 11:23:45 +08:00
|
|
|
{ path: '/n-popselect', component: popselect },
|
2019-10-12 15:46:02 +08:00
|
|
|
{ path: '/n-app', component: app },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-cancel-mark-debug', component: cancelMarkDebug },
|
|
|
|
{ path: '/n-transfer', component: transferDemo },
|
2019-10-15 18:01:18 +08:00
|
|
|
{ path: '/n-spin', component: spin },
|
2019-09-04 21:56:58 +08:00
|
|
|
{ path: '/n-drawer', component: drawerDemo },
|
2019-10-08 14:14:30 +08:00
|
|
|
{ path: '/n-loading-bar', component: loadingBar },
|
2019-09-05 18:06:01 +08:00
|
|
|
{ path: '/n-time', component: timeDemo },
|
|
|
|
{ path: '/n-slider', component: sliderDemo },
|
2019-09-12 11:58:46 +08:00
|
|
|
{ path: '/n-tree', component: treeDemo },
|
2019-10-13 20:16:43 +08:00
|
|
|
{ path: '/n-vertical-align-debug', component: verticalAlignDebug },
|
|
|
|
{ path: '/n-affix', component: affix }
|
2019-09-24 16:59:07 +08:00
|
|
|
])
|
2019-09-04 21:56:58 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/*',
|
2019-09-27 16:02:06 +08:00
|
|
|
redirect: '/en-us/dark/start'
|
2019-09-04 21:56:58 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
const router = new VueRouter({
|
2019-10-14 13:10:26 +08:00
|
|
|
mode: 'history',
|
2019-09-04 21:56:58 +08:00
|
|
|
routes
|
|
|
|
})
|
|
|
|
|
2019-09-06 16:15:19 +08:00
|
|
|
router.beforeEach(function (to, from, next) {
|
2019-10-08 14:14:30 +08:00
|
|
|
Vue.prototype.$NLoadingBar.theme = to.params.theme
|
2019-10-14 13:10:26 +08:00
|
|
|
if (to.path !== from.path) {
|
|
|
|
Vue.prototype.$NLoadingBar.start()
|
|
|
|
}
|
2019-09-06 16:15:19 +08:00
|
|
|
next()
|
|
|
|
})
|
|
|
|
|
2019-10-14 13:10:26 +08:00
|
|
|
router.afterEach(function (to, from) {
|
|
|
|
if (to.path !== from.path) {
|
|
|
|
Vue.prototype.$NLoadingBar.finish()
|
|
|
|
}
|
2019-09-06 16:15:19 +08:00
|
|
|
})
|
|
|
|
|
2019-09-21 17:03:37 +08:00
|
|
|
export { Vue, router, i18n }
|