fix: typo

This commit is contained in:
hrsonion 2019-06-12 16:44:32 +08:00
parent 407c2680de
commit 8ee57c01e9
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,7 @@
import WithMargin from './src/main.vue'
WithMargin.install = function (Vue) {
Vue.component(WithMargin.name, WithMargin)
}
export default WithMargin

View File

@ -0,0 +1,42 @@
<template>
<div
class="nv-with-margin"
:style="style"
>
<slot />
</div>
</template>
<script>
export default {
name: 'NvWithMargin',
props: {
marginTop: {
type: Number,
default: 0
},
marginRight: {
type: Number,
default: 0
},
marginBottom: {
type: Number,
default: 0
},
marginLeft: {
type: Number,
default: 0
}
},
computed: {
style () {
const marginStyle = {}
if (this.marginTop) marginStyle.marginTop = this.marginTop + 'px'
if (this.marginRight) marginStyle.marginRight = this.marginRight + 'px'
if (this.marginBottom) marginStyle.marginBottom = this.marginBottom + 'px'
if (this.marginLeft) marginStyle.marginLeft = this.marginLeft + 'px'
return marginStyle
}
}
}
</script>