This commit is contained in:
zhigang.li 2017-12-18 18:36:50 +08:00
parent a2eb028782
commit f724eb5797
2 changed files with 43 additions and 45 deletions

View file

@ -1,43 +1,43 @@
<template> <template>
<div :class="wrapClasses"><slot></slot></div> <div :class="wrapClasses"><slot></slot></div>
</template> </template>
<script> <script>
const prefixCls = 'ivu-layout'; const prefixCls = 'ivu-layout';
export default { export default {
name: 'Layout', name: 'Layout',
props: { props: {
className: { className: {
type: String, type: String,
default: '' default: ''
} }
}, },
data () { data () {
return { return {
prefixCls: prefixCls, prefixCls: prefixCls,
hasSider: false hasSider: false
}; };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
return [ return [
`${prefixCls}`, `${prefixCls}`,
this.className, this.className,
{ {
[`${prefixCls}-has-sider`]: this.hasSider [`${prefixCls}-has-sider`]: this.hasSider
} }
]; ];
} }
}, },
methods: { methods: {
findSider () { findSider () {
return this.$children.some(child => { return this.$children.some(child => {
return child.$options._componentTag === 'Sider'; return child.$options._componentTag === 'Sider';
}); });
} }
}, },
mounted () { mounted () {
this.hasSider = this.findSider(); this.hasSider = this.findSider();
} }
}; };
</script> </script>

View file

@ -29,10 +29,8 @@
return { return {
media: mediaQuery, media: mediaQuery,
matches: false, matches: false,
on() { on() {},
}, off() {},
off() {
},
}; };
}; };
window.matchMedia = window.matchMedia || matchMediaPolyfill; window.matchMedia = window.matchMedia || matchMediaPolyfill;