Commit e9ad2b7a9426ca40f3900d4bad997f262615a8d8
1 parent
32fd4ffa
update Divider
Showing
2 changed files
with
104 additions
and
98 deletions
Show diff stats
examples/routers/divider.vue
| 1 | <template> | 1 | <template> |
| 2 | - <Row :gutter="16"> | ||
| 3 | - <Col span="12"> | ||
| 4 | - <Card title="horizontal divider"> | ||
| 5 | - <div> | ||
| 6 | - <p>iView is a set of UI components and widgets built on Vue.js. | ||
| 7 | - iView is a set of UI components and widgets built on Vue.js. | ||
| 8 | - iView is a set of UI components and widgets built on Vue.js.</p> | 2 | + <Row :gutter="16"> |
| 3 | + <i-col span="12"> | ||
| 4 | + <Card title="horizontal divider"> | ||
| 5 | + <div> | ||
| 6 | + <p> | ||
| 7 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 8 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 9 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 10 | + </p> | ||
| 9 | 11 | ||
| 10 | - <Divider /> | 12 | + <Divider/> |
| 11 | 13 | ||
| 12 | - <p>iView is a set of UI components and widgets built on Vue.js. | ||
| 13 | - iView is a set of UI components and widgets built on Vue.js. | ||
| 14 | - iView is a set of UI components and widgets built on Vue.js.</p> | 14 | + <p> |
| 15 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 16 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 17 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 18 | + </p> | ||
| 15 | 19 | ||
| 16 | - <Divider>iView </Divider> | 20 | + <Divider>iView </Divider> |
| 17 | 21 | ||
| 18 | - <p>iView is a set of UI components and widgets built on Vue.js. | ||
| 19 | - iView is a set of UI components and widgets built on Vue.js. | ||
| 20 | - iView is a set of UI components and widgets built on Vue.js.</p> | 22 | + <p> |
| 23 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 24 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 25 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 26 | + </p> | ||
| 21 | 27 | ||
| 22 | - <Divider dashed /> | 28 | + <Divider dashed/> |
| 23 | 29 | ||
| 24 | - <p>iView is a set of UI components and widgets built on Vue.js. | ||
| 25 | - iView is a set of UI components and widgets built on Vue.js. | ||
| 26 | - iView is a set of UI components and widgets built on Vue.js.</p> | 30 | + <p> |
| 31 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 32 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 33 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 34 | + </p> | ||
| 27 | 35 | ||
| 28 | - <Divider orientation="left">iView</Divider> | 36 | + <Divider orientation="left">iView</Divider> |
| 29 | 37 | ||
| 30 | - <p>iView is a set of UI components and widgets built on Vue.js. | ||
| 31 | - iView is a set of UI components and widgets built on Vue.js. | ||
| 32 | - iView is a set of UI components and widgets built on Vue.js.</p> | 38 | + <p> |
| 39 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 40 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 41 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 42 | + </p> | ||
| 33 | 43 | ||
| 34 | - <Divider orientation="right">iView</Divider> | 44 | + <Divider orientation="right">iView</Divider> |
| 35 | 45 | ||
| 36 | - <p>iView is a set of UI components and widgets built on Vue.js. | ||
| 37 | - iView is a set of UI components and widgets built on Vue.js. | ||
| 38 | - iView is a set of UI components and widgets built on Vue.js.</p> | 46 | + <p> |
| 47 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 48 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 49 | + iView is a set of UI components and widgets built on Vue.js. | ||
| 50 | + </p> | ||
| 39 | 51 | ||
| 40 | - </div> | ||
| 41 | - </Card> | ||
| 42 | - </Col> | ||
| 43 | - <Col span="12"> | ||
| 44 | - <Card title="vertical divider"> | ||
| 45 | - <div> | ||
| 46 | - iView | ||
| 47 | - <Divider type="vertical divider" /> | ||
| 48 | - <a href="#">Components</a> | ||
| 49 | - <Divider type="vertical" /> | ||
| 50 | - <a href="#">Divider</a> | ||
| 51 | - </div> | ||
| 52 | - </Card> | ||
| 53 | - </Col> | ||
| 54 | - </Row> | 52 | + </div> |
| 53 | + </Card> | ||
| 54 | + </i-col> | ||
| 55 | + <i-col span="12"> | ||
| 56 | + <Card title="vertical divider"> | ||
| 57 | + <div> | ||
| 58 | + iView | ||
| 59 | + <Divider type="vertical" /> | ||
| 60 | + <a href="#">Components</a> | ||
| 61 | + <Divider type="vertical" /> | ||
| 62 | + <a href="#">Divider</a> | ||
| 63 | + </div> | ||
| 64 | + </Card> | ||
| 65 | + </i-col> | ||
| 66 | + </Row> | ||
| 55 | </template> | 67 | </template> |
| 56 | 68 | ||
| 57 | <script> | 69 | <script> |
| 58 | -export default { | ||
| 59 | - | ||
| 60 | -} | 70 | + export default {} |
| 61 | </script> | 71 | </script> |
| 62 | 72 | ||
| 63 | <style> | 73 | <style> |
src/components/divider/divider.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div :class="classes"> | ||
| 3 | - <span v-if="hasSlot" :class="slotClasses"> | ||
| 4 | - <slot></slot> | ||
| 5 | - </span> | ||
| 6 | - </div> | 2 | + <div :class="classes"> |
| 3 | + <span v-if="hasSlot" :class="slotClasses"> | ||
| 4 | + <slot></slot> | ||
| 5 | + </span> | ||
| 6 | + </div> | ||
| 7 | </template> | 7 | </template> |
| 8 | 8 | ||
| 9 | <script> | 9 | <script> |
| 10 | -import { oneOf } from '../../utils/assist'; | 10 | + import {oneOf} from '../../utils/assist'; |
| 11 | 11 | ||
| 12 | -const prefixCls = 'ivu-divider'; | 12 | + const prefixCls = 'ivu-divider'; |
| 13 | 13 | ||
| 14 | -export default { | ||
| 15 | - name:'Divider', | ||
| 16 | - props: { | ||
| 17 | - type: { | ||
| 18 | - type: String, | ||
| 19 | - default() { return 'horizontal'; }, | ||
| 20 | - validator (value) { | ||
| 21 | - return oneOf(value, ['horizontal', 'vertical']); | ||
| 22 | - } | ||
| 23 | - }, | ||
| 24 | - orientation: { | ||
| 25 | - type: String, | ||
| 26 | - default() { return 'left'; }, | ||
| 27 | - validator (value) { | ||
| 28 | - return oneOf(value, ['left', 'right']); | ||
| 29 | - } | ||
| 30 | - }, | ||
| 31 | - dashed:{ | ||
| 32 | - type: Boolean, | ||
| 33 | - default: false, | ||
| 34 | - } | ||
| 35 | - }, | ||
| 36 | - computed: { | ||
| 37 | - hasSlot() { | ||
| 38 | - return !!this.$slots.default; | ||
| 39 | - }, | ||
| 40 | - classes() { | ||
| 41 | - return [ | ||
| 42 | - `${prefixCls}`, | ||
| 43 | - `${prefixCls}-${this.type}`, | ||
| 44 | - { | ||
| 45 | - [`${prefixCls}-with-text-${this.orientation}`]: this.hasSlot, | ||
| 46 | - [`${prefixCls}-dashed`]: !!this.dashed | 14 | + export default { |
| 15 | + name: 'Divider', | ||
| 16 | + props: { | ||
| 17 | + type: { | ||
| 18 | + type: String, | ||
| 19 | + default: 'horizontal', | ||
| 20 | + validator (value) { | ||
| 21 | + return oneOf(value, ['horizontal', 'vertical']); | ||
| 22 | + } | ||
| 23 | + }, | ||
| 24 | + orientation: { | ||
| 25 | + type: String, | ||
| 26 | + default: 'left', | ||
| 27 | + validator (value) { | ||
| 28 | + return oneOf(value, ['left', 'right']); | ||
| 29 | + } | ||
| 30 | + }, | ||
| 31 | + dashed: { | ||
| 32 | + type: Boolean, | ||
| 33 | + default: false, | ||
| 34 | + } | ||
| 35 | + }, | ||
| 36 | + computed: { | ||
| 37 | + hasSlot() { | ||
| 38 | + return !!this.$slots.default; | ||
| 39 | + }, | ||
| 40 | + classes() { | ||
| 41 | + return [ | ||
| 42 | + `${prefixCls}`, | ||
| 43 | + `${prefixCls}-${this.type}`, | ||
| 44 | + { | ||
| 45 | + [`${prefixCls}-with-text-${this.orientation}`]: this.hasSlot, | ||
| 46 | + [`${prefixCls}-dashed`]: !!this.dashed | ||
| 47 | + } | ||
| 48 | + ]; | ||
| 49 | + }, | ||
| 50 | + slotClasses() { | ||
| 51 | + return [ | ||
| 52 | + `${prefixCls}-inner-text`, | ||
| 53 | + ] | ||
| 54 | + } | ||
| 47 | } | 55 | } |
| 48 | - ]; | ||
| 49 | - }, | ||
| 50 | - slotClasses() { | ||
| 51 | - return [ | ||
| 52 | - `${prefixCls}-inner-text`, | ||
| 53 | - ] | ||
| 54 | } | 56 | } |
| 55 | - } | ||
| 56 | -} | ||
| 57 | -</script> | ||
| 58 | - | ||
| 59 | -<style> | ||
| 60 | - | ||
| 61 | -</style> | 57 | +</script> |
| 62 | \ No newline at end of file | 58 | \ No newline at end of file |