mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-03 04:21:34 +08:00
fix: typo
This commit is contained in:
parent
407c2680de
commit
8ee57c01e9
7
packages/common/WithMargin/index.js
Normal file
7
packages/common/WithMargin/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
import WithMargin from './src/main.vue'
|
||||
|
||||
WithMargin.install = function (Vue) {
|
||||
Vue.component(WithMargin.name, WithMargin)
|
||||
}
|
||||
|
||||
export default WithMargin
|
42
packages/common/WithMargin/src/main.vue
Normal file
42
packages/common/WithMargin/src/main.vue
Normal 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>
|
Loading…
Reference in New Issue
Block a user