Blame view

src/components/layout/layout.vue 834 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
          data () {
              return {
f724eb57   zhigang.li   update
11
12
13
14
15
16
17
                  hasSider: false
              };
          },
          computed: {
              wrapClasses () {
                  return [
                      `${prefixCls}`,
f724eb57   zhigang.li   update
18
19
20
21
22
23
24
25
26
                      {
                          [`${prefixCls}-has-sider`]: this.hasSider
                      }
                  ];
              }
          },
          methods: {
              findSider () {
                  return this.$children.some(child => {
cbba62ae   zhigang.li   close #2318
27
                      return child.$options._componentTag === 'Sider'; 
f724eb57   zhigang.li   update
28
29
30
31
32
33
34
35
                  });
              }
          },
          mounted () {
              this.hasSider = this.findSider();
          }
      };
  </script>