vue中实现tag标签

1,安装scss插件

cnpm i node-sass sass-loader -S

2,安装element-ui

cnpm i element-ui -S

main.js中引入element-ui

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

3,项目结构

vue中实现tag标签_第1张图片

App.vue




main.js

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

 router文件夹下的index.js

import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    redirect:'/index',
    component: Home,
    meta:{title:'首页'},
    children:[
      {
        path:'/index',
        name:'index',
        component:()=>import('@/views/index.vue'),
        meta:{
          title:'系统首页',
          hideclose:true
        }
      },
      {
        path:'/test/test1',
        name:'test1',
        component:()=>import('@/views/test/test1.vue'),
        meta:{
          title:'test1'
        }
      },
      {
        path:'/test/test2',
        name:'test2',
        component:()=>import('@/views/test/test2.vue'),
        meta:{
          title:'test2'
        }
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router

common文件夹目录

vue中实现tag标签_第2张图片

bus.js

import Vue from 'vue';
// 使用 Event Bus
const bus = new Vue();
export default bus;

header.vue





 aside.vue




tag.vue





footer.vue



test文件夹目录

test1.vue


test2.vue


index.vue

Home.vue






运行效果

vue中实现tag标签_第3张图片

你可能感兴趣的:(Vue)