Commit 1d247d20997948ea837361952647e9d42db3e6e1
1 parent
21ff0303
update Modal & Notice style
Showing
3 changed files
with
37 additions
and
31 deletions
Show diff stats
examples/routers/modal.vue
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | - <Button type="primary" @click="modal1 = true">Display dialog box</Button> | ||
| 4 | - <Modal | ||
| 5 | - v-model="modal1" | ||
| 6 | - title="Common Modal dialog box title" | ||
| 7 | - @on-ok="ok" | ||
| 8 | - @on-cancel="cancel"> | ||
| 9 | - <p>Content of dialog</p> | ||
| 10 | - <p>Content of dialog</p> | ||
| 11 | - <p>Content of dialog</p> | ||
| 12 | - </Modal> | 3 | + <Button @click="instance('info')">Info</Button> |
| 4 | + <Button @click="instance('success')">Success</Button> | ||
| 5 | + <Button @click="instance('warning')">Warning</Button> | ||
| 6 | + <Button @click="instance('error')">Error</Button> | ||
| 13 | </div> | 7 | </div> |
| 14 | </template> | 8 | </template> |
| 15 | <script> | 9 | <script> |
| 16 | export default { | 10 | export default { |
| 17 | - data () { | ||
| 18 | - return { | ||
| 19 | - modal1: false | ||
| 20 | - } | ||
| 21 | - }, | ||
| 22 | methods: { | 11 | methods: { |
| 23 | - ok () { | ||
| 24 | - this.$Message.info('Clicked ok'); | ||
| 25 | - }, | ||
| 26 | - cancel () { | ||
| 27 | - this.$Message.info('Clicked cancel'); | 12 | + instance (type) { |
| 13 | + const title = 'Title'; | ||
| 14 | + const content = '<p>Content of dialog</p><p>Content of dialog</p>'; | ||
| 15 | + switch (type) { | ||
| 16 | + case 'info': | ||
| 17 | + this.$Modal.info({ | ||
| 18 | + title: title, | ||
| 19 | + content: content | ||
| 20 | + }); | ||
| 21 | + break; | ||
| 22 | + case 'success': | ||
| 23 | + this.$Modal.success({ | ||
| 24 | + title: title, | ||
| 25 | + content: content | ||
| 26 | + }); | ||
| 27 | + break; | ||
| 28 | + case 'warning': | ||
| 29 | + this.$Modal.warning({ | ||
| 30 | + title: title, | ||
| 31 | + content: content | ||
| 32 | + }); | ||
| 33 | + break; | ||
| 34 | + case 'error': | ||
| 35 | + this.$Modal.error({ | ||
| 36 | + title: title, | ||
| 37 | + content: content | ||
| 38 | + }); | ||
| 39 | + break; | ||
| 40 | + } | ||
| 28 | } | 41 | } |
| 29 | } | 42 | } |
| 30 | } | 43 | } |
src/styles/components/modal.less
| @@ -144,7 +144,7 @@ | @@ -144,7 +144,7 @@ | ||
| 144 | font-size: 28px; | 144 | font-size: 28px; |
| 145 | vertical-align: middle; | 145 | vertical-align: middle; |
| 146 | position: relative; | 146 | position: relative; |
| 147 | - top: 3px; | 147 | + top: -2px; |
| 148 | 148 | ||
| 149 | &-info { | 149 | &-info { |
| 150 | color: @primary-color; | 150 | color: @primary-color; |
src/styles/components/notice.less
| @@ -89,7 +89,7 @@ | @@ -89,7 +89,7 @@ | ||
| 89 | 89 | ||
| 90 | &-icon { | 90 | &-icon { |
| 91 | position: absolute; | 91 | position: absolute; |
| 92 | - left: 16px; | 92 | + top: -2px; |
| 93 | font-size: @font-size-large; | 93 | font-size: @font-size-large; |
| 94 | 94 | ||
| 95 | &-success { | 95 | &-success { |
| @@ -107,17 +107,10 @@ | @@ -107,17 +107,10 @@ | ||
| 107 | } | 107 | } |
| 108 | &-with-desc &-icon{ | 108 | &-with-desc &-icon{ |
| 109 | font-size: 36px; | 109 | font-size: 36px; |
| 110 | + top: -6px; | ||
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | &-custom-content{ | 113 | &-custom-content{ |
| 113 | - &:after{ | ||
| 114 | - content: ""; | ||
| 115 | - display: block; | ||
| 116 | - width: 4px; | ||
| 117 | - position: absolute; | ||
| 118 | - top: 0; | ||
| 119 | - bottom: 0; | ||
| 120 | - left: 0; | ||
| 121 | - } | 114 | + position: relative; |
| 122 | } | 115 | } |
| 123 | } | 116 | } |
| 124 | \ No newline at end of file | 117 | \ No newline at end of file |