abstract some component

This commit is contained in:
jiaming 2018-12-17 16:48:46 +08:00
parent 4c2d8e2cdf
commit b553ef8e16
5 changed files with 56 additions and 4 deletions

8
src/auxiliary/index.js Normal file
View File

@ -0,0 +1,8 @@
import highlightCode from './highlightCode'
import sideNav from './sideNav'
export default function (Vue) {
Vue.component('highlightCode', highlightCode)
Vue.component('sideNav', sideNav)
}

View File

@ -0,0 +1,42 @@
<template>
<div class="side-nav">
<div class="item" v-for="navItem in nav" :key="navItem.title">
<a :href="`#${navItem.target}`">{{ navItem.title }}</a>
</div>
</div>
</template>
<script>
export default {
name: 'SideNav',
props: ['nav']
}
</script>
<style lang="less">
.side-nav {
position: fixed;
width: 150px;
left: 20px;
top: 50%;
transform: translateY(-50%);
.item {
font-weight: bold;
color: #fff;
height: 30px;
line-height: 30px;
font-size: 18px;
a {
color: #fff;
&:hover,
&:active,
&:visited {
color: #fff;
}
}
}
}
</style>

View File

@ -22,10 +22,9 @@ import radarChart from './radarChart/index.vue'
import numberShow from './numberShow/index.vue'
import percentPond from './percentPond/index.vue'
import waterLevelPond from './waterLevelPond/index.vue'
import scrollBoard from './scrollBoard/index.vue'
import highlightCode from './highlightCode'
export default function (Vue) {
Vue.component('borderBox1', borderBox1)
Vue.component('borderBox2', borderBox2)
@ -51,7 +50,6 @@ export default function (Vue) {
Vue.component('numberShow', numberShow)
Vue.component('percentPond', percentPond)
Vue.component('waterLevelPond', waterLevelPond)
Vue.component('scrollBoard', scrollBoard)
Vue.component('highlightCode', highlightCode)
}

View File

@ -6,10 +6,14 @@ import './assets/style/index.less'
import plugins from './plugins/index'
import auxiliary from './auxiliary/index'
import components from './components/index'
Vue.use(plugins)
Vue.use(auxiliary)
Vue.use(components)
Vue.config.productionTip = false