增加zan-layout

This commit is contained in:
niunai
2017-03-03 17:58:08 +08:00
parent cead595693
commit e918c52fd0
23 changed files with 337 additions and 124 deletions
+38
View File
@@ -0,0 +1,38 @@
<template>
<div
:class="[
`${prefix}-col`,
{
[`${prefix}-col-${span}`]: span,
[`${prefix}-col-offset-${offset}`]: offset,
}
]"
:style="style">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'zan-col',
props: {
span: [Number, String],
offset: [Number, String],
prefix: {
type: String,
default: 'zan'
}
},
computed: {
gutter() {
return Number(this.$parent.gutter);
},
style() {
const padding = `${this.gutter / 2}px`;
return this.gutter ?
{ paddingLeft: padding, paddingRight: padding } :
null;
}
}
};
</script>