update Divider

This commit is contained in:
梁灏 2018-06-20 11:31:38 +08:00
parent 32fd4ffa06
commit e9ad2b7a94
2 changed files with 104 additions and 98 deletions

View file

@ -1,63 +1,73 @@
<template> <template>
<Row :gutter="16"> <Row :gutter="16">
<Col span="12"> <i-col span="12">
<Card title="horizontal divider"> <Card title="horizontal divider">
<div> <div>
<p>iView is a set of UI components and widgets built on Vue.js. <p>
iView is a set of UI components and widgets built on Vue.js. iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.</p> iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider /> <Divider/>
<p>iView is a set of UI components and widgets built on Vue.js. <p>
iView is a set of UI components and widgets built on Vue.js. iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.</p> iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider>iView </Divider> <Divider>iView </Divider>
<p>iView is a set of UI components and widgets built on Vue.js. <p>
iView is a set of UI components and widgets built on Vue.js. iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.</p> iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider dashed /> <Divider dashed/>
<p>iView is a set of UI components and widgets built on Vue.js. <p>
iView is a set of UI components and widgets built on Vue.js. iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.</p> iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider orientation="left">iView</Divider> <Divider orientation="left">iView</Divider>
<p>iView is a set of UI components and widgets built on Vue.js. <p>
iView is a set of UI components and widgets built on Vue.js. iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.</p> iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider orientation="right">iView</Divider> <Divider orientation="right">iView</Divider>
<p>iView is a set of UI components and widgets built on Vue.js. <p>
iView is a set of UI components and widgets built on Vue.js. iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.</p> iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
</div> </div>
</Card> </Card>
</Col> </i-col>
<Col span="12"> <i-col span="12">
<Card title="vertical divider"> <Card title="vertical divider">
<div> <div>
iView iView
<Divider type="vertical divider" /> <Divider type="vertical" />
<a href="#">Components</a> <a href="#">Components</a>
<Divider type="vertical" /> <Divider type="vertical" />
<a href="#">Divider</a> <a href="#">Divider</a>
</div> </div>
</Card> </Card>
</Col> </i-col>
</Row> </Row>
</template> </template>
<script> <script>
export default { export default {}
}
</script> </script>
<style> <style>

View file

@ -1,61 +1,57 @@
<template> <template>
<div :class="classes"> <div :class="classes">
<span v-if="hasSlot" :class="slotClasses"> <span v-if="hasSlot" :class="slotClasses">
<slot></slot> <slot></slot>
</span> </span>
</div> </div>
</template> </template>
<script> <script>
import { oneOf } from '../../utils/assist'; import {oneOf} from '../../utils/assist';
const prefixCls = 'ivu-divider'; const prefixCls = 'ivu-divider';
export default { export default {
name:'Divider', name: 'Divider',
props: { props: {
type: { type: {
type: String, type: String,
default() { return 'horizontal'; }, default: 'horizontal',
validator (value) { validator (value) {
return oneOf(value, ['horizontal', 'vertical']); return oneOf(value, ['horizontal', 'vertical']);
} }
}, },
orientation: { orientation: {
type: String, type: String,
default() { return 'left'; }, default: 'left',
validator (value) { validator (value) {
return oneOf(value, ['left', 'right']); return oneOf(value, ['left', 'right']);
} }
}, },
dashed:{ dashed: {
type: Boolean, type: Boolean,
default: false, default: false,
} }
}, },
computed: { computed: {
hasSlot() { hasSlot() {
return !!this.$slots.default; return !!this.$slots.default;
}, },
classes() { classes() {
return [ return [
`${prefixCls}`, `${prefixCls}`,
`${prefixCls}-${this.type}`, `${prefixCls}-${this.type}`,
{ {
[`${prefixCls}-with-text-${this.orientation}`]: this.hasSlot, [`${prefixCls}-with-text-${this.orientation}`]: this.hasSlot,
[`${prefixCls}-dashed`]: !!this.dashed [`${prefixCls}-dashed`]: !!this.dashed
}
];
},
slotClasses() {
return [
`${prefixCls}-inner-text`,
]
}
} }
];
},
slotClasses() {
return [
`${prefixCls}-inner-text`,
]
} }
} </script>
}
</script>
<style>
</style>