1.main.js 引入element-ui

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import NormailizeCss from 'normalize.css'
import 'vue-awesome/icons'
import Icon from 'vue-awesome/components/Icon'

Vue.use(ElementUI);
Vue.component('icon', Icon)

2.安装依赖库

cnpm i element-ui -S
cnpm i normalize.css -D
cnpm i vue-awesome -D

3.页面头

<template>
  <el-row>
    <el-col :span="24"
      <div class="head-wrap">HEAD</div>
    </el-col>
  </el-row>
</template>

<style scoped>
.head-wrap{

}
</style>

4.菜单

<template>
  <el-row class="tac">
    <el-col :span="24">
      <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
      unique-opened
      router
      background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
        <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>菜单</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="list">列表</el-menu-item>
            <el-menu-item index="form">表单</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
		
		
      </el-menu>
    </el-col>
  </el-row>
</template>

<script>
  export default {
    methods: {
      handleOpen(key, keyPath) {
        //console.log(key, keyPath)
      },
      handleClose(key, keyPath) {
        //console.log(key, keyPath)
      }
    }
  }
</script>

4.主框架

<template>
  <div id="app">
    <el-container>
      <el-header class="header">
        <vheader />
      </el-header>
      <el-container>
        <el-aside width="200px">
          <navmenu></navmenu>
        </el-aside>
        <el-main>
			<router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>
import NavMenu from '@/components/NavMenu'
import Header from '@/components/Header'

export default {
  name: 'app',
  components: {
    'navmenu': NavMenu,
    'vheader': Header
  }
}

</script>

<style>
.header {
  background-color: #409EFF;
  color: #fff;
  line-height: 60px;
}
</style>

5.效果

 

Logo

前往低代码交流专区

更多推荐