Blame view

src/components/layout/layout.vue 872 Bytes
a2eb0287   zhigang.li   add layout compon...
1
2
  <template>
       <div :class="wrapClasses"><slot></slot></div>
f724eb57   zhigang.li   update
3
4
5
6
7
8
  </template>
  <script>
      const prefixCls = 'ivu-layout';
  
      export default {
          name: 'Layout',
f724eb57   zhigang.li   update
9
10
11
12
13
14
15
16
17
18
          data () {
              return {
                  prefixCls: prefixCls,
                  hasSider: false
              };
          },
          computed: {
              wrapClasses () {
                  return [
                      `${prefixCls}`,
f724eb57   zhigang.li   update
19
20
21
22
23
24
25
26
27
                      {
                          [`${prefixCls}-has-sider`]: this.hasSider
                      }
                  ];
              }
          },
          methods: {
              findSider () {
                  return this.$children.some(child => {
cbba62ae   zhigang.li   close #2318
28
                      return child.$options._componentTag === 'Sider'; 
f724eb57   zhigang.li   update
29
30
31
32
33
34
35
36
                  });
              }
          },
          mounted () {
              this.hasSider = this.findSider();
          }
      };
  </script>