| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <template>
- <div class="layout">
- <div class="top">
- <div class="logo">
- <img src="@/assets/img/logo.png" alt="" />
- </div>
- <div class="right">
- <div class="txt">项目资料管理系统</div>
- <div class="user">
- <span>用户名</span>
- <img src="@/assets/img/user.jpg" alt="" />
- </div>
- </div>
- </div>
- <div class="conten">
- <div class="leftTab">
- <div class="title">数据管理</div>
- <ul>
- <li v-for="item in tabList1" :key="item.id" :class="{active:index===item.id}" @click="skip(item.id,item.path)">{{item.name}}</li>
- </ul>
- <div class="title">系统管理</div>
- <ul>
- <li v-for="item in tabList2" :key="item.id" :class="{active:index===item.id}" @click="skip(item.id,item.path)">{{item.name}}</li>
- </ul>
- </div>
- <!-- 右侧内容 -->
- <Router-view style="width: 1630px;"/>
- </div>
- </div>
- </template>
- <script>
- // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- // 例如:import 《组件名称》 from '《组件路径》';
- export default {
- // import引入的组件需要注入到对象中才能使用
- components: {},
- data () {
- // 这里存放数据
- return {
- index: 1,
- tabList1: [
- { id: 1, name: '项目资料', path: '/layout/tab1' },
- { id: 2, name: '文物案例', path: '/layout/tab2' },
- { id: 3, name: '场景案例', path: '/layout/tab3' }
- ],
- tabList2: [
- { id: 4, name: '用户管理', path: '/layout/tab4' },
- { id: 5, name: '操作日志', path: '/layout/tab5' }
- ]
- }
- },
- // 监听属性 类似于data概念
- computed: {},
- // 监控data中的数据变化
- watch: {},
- // 方法集合
- methods: {
- skip (id, url) {
- this.index = id
- this.$router.push(url).catch(() => {})
- }
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- created () {},
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted () {},
- beforeCreate () {}, // 生命周期 - 创建之前
- beforeMount () {}, // 生命周期 - 挂载之前
- beforeUpdate () {}, // 生命周期 - 更新之前
- updated () {}, // 生命周期 - 更新之后
- beforeDestroy () {}, // 生命周期 - 销毁之前
- destroyed () {}, // 生命周期 - 销毁完成
- activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
- }
- </script>
- <style lang='less' scoped>
- .layout {
- .top {
- display: flex;
- padding: 10px 0;
- height: 60px;
- background-color: #f6f8f9;
- }
- .logo {
- width: 290px;
- border-right: 3px dashed #343a40;
- text-align: center;
- }
- .right {
- flex: 1;
- padding: 0 60px;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .txt {
- font-size: 24px;
- font-weight: 700;
- }
- .user {
- display: flex;
- align-items: center;
- img {
- margin-left: 15px;
- width: 34px;
- height: 34px;
- border-radius: 50%;
- overflow: hidden;
- }
- }
- }
- .leftTab {
- font-size: 24px;
- color: #fff;
- padding: 30px 25px;
- width: 290px;
- height: calc(100vh - 60px);
- min-height: 870px;
- background-color: rgba(0, 0, 0, 0.8);
- .title {
- margin-top: 30px;
- width: 230px;
- height: 60px;
- display: flex;
- justify-content: center;
- align-items: center;
- background-color: #dc3545;
- }
- ul {
- margin-top: 15px;
- li {
- cursor: pointer;
- width: 230px;
- height: 60px;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- li:hover{
- background-color:rgba(220, 53, 69, .6) ;
- }
- .active {
- background-color:rgba(220, 53, 69, .6) ;
- }
- }
- }
- .conten{
- display: flex;
- }
- }
- </style>
|