Blame view

examples/routers/layout.vue 2.44 KB
a2eb0287   zhigang.li   add layout compon...
1
2
  <template>
      <div class="layout-demo-con">
1f7c24bc   zhigang.li   fixed https://git...
3
          <Button @click="change">修改Sider绑定的变量来控制收缩</Button>
a2eb0287   zhigang.li   add layout compon...
4
5
6
7
          <Layout :style="{minHeight: '100vh'}">
              <Sider 
                  v-model="isCollapsed"
                  collapsed-width="0" 
716d151a   zhigang.li   make it will not ...
8
                  hide-trigger
1f7c24bc   zhigang.li   fixed https://git...
9
10
                  breakpoint="sm"
                  @on-collapse="changed"
1c26d05c   zhigang.li   add 'collapsible'...
11
                  collapsible
a2eb0287   zhigang.li   add layout compon...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
                  ref="side"
                  width="200">
                  <Menu width="auto" theme="dark" active-name="1">
                      <MenuGroup title="内容管理">
                          <MenuItem name="1">
                              <Icon type="document-text"></Icon>
                              文章管理
                          </MenuItem>
                          <MenuItem name="2">
                              <Icon type="chatbubbles"></Icon>
                              评论管理
                          </MenuItem>
                      </MenuGroup>
                      <MenuGroup title="统计分析">
                          <MenuItem name="3">
                              <Icon type="heart"></Icon>
                              用户留存
                          </MenuItem>
                          <MenuItem name="4">
                              <Icon type="heart-broken"></Icon>
                              流失用户
                          </MenuItem>
                      </MenuGroup>
                  </Menu>
716d151a   zhigang.li   make it will not ...
36
                  <!-- <div slot="trigger"><Icon type="document-text"></Icon></div> -->
a2eb0287   zhigang.li   add layout compon...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
              </Sider>
              <Layout class-name="test-class">
                  <Header :style="{background: '#eee'}"><Button @click="toggleCollapse">菜单</Button></Header>
                  <Content :style="{background:'#FFCF9E'}">
                      <p v-for="i in 100" :key="i">{{ i }}</p>
                  </Content>
                  <Footer>sdfsdsdfsdfs</Footer>
              </Layout>
          </Layout>
      </div>
  </template>
  <script>
  export default {
      data () {
          return {
              isCollapsed: false
          };
      },
      methods: {
          toggleCollapse () {
              this.$refs.side.toggleCollapse();
1f7c24bc   zhigang.li   fixed https://git...
58
59
60
61
62
63
          },
          change () {
              this.isCollapsed = !this.isCollapsed;
          },
          changed (res) {
              console.log(res)
a2eb0287   zhigang.li   add layout compon...
64
          }
716d151a   zhigang.li   make it will not ...
65
66
67
68
69
      },
      watch: {
          isCollapsed (val) {
              // console.log(val)
          }
a2eb0287   zhigang.li   add layout compon...
70
71
72
73
74
75
76
77
      }
  };
  </script>
  <style lang="less" scoped>
      .layout-demo-con{
          height: 100%;
      }
  </style>