Commit 45ad8fb8437b78a781e41b143d95be44e9530cbe

Authored by Rijn Bian
Committed by GitHub
2 parents a87da689 f78d6ab8

Merge branch 'master' into 295

src/components/input-number/input-number.vue
... ... @@ -34,7 +34,7 @@
34 34 const iconPrefixCls = 'ivu-icon';
35 35  
36 36 function isValueNumber (value) {
37   - return (/(^-?[0-9]+\.{1}\d+$)|(^-?[1-9][0-9]*$)/).test(value + '');
  37 + return (/(^-?[0-9]+\.{1}\d+$)|(^-?[1-9][0-9]*$)|(^-?0{1}$)/).test(value + '');
38 38 }
39 39 function addNum (num1, num2) {
40 40 let sq1, sq2, m;
... ...
src/components/modal/modal.vue
1 1 <template>
2   - <div :class="wrapClasses">
3   - <div :class="maskClasses" v-show="visible" @click="mask" transition="fade"></div>
  2 + <div :class="maskClasses" v-show="visible" @click="mask" transition="fade"></div>
  3 + <div :class="wrapClasses" @click="handleWrapClick">
4 4 <div :class="classes" :style="styles" v-show="visible" transition="ease">
5 5 <div :class="[prefixCls + '-content']">
6 6 <a :class="[prefixCls + '-close']" v-if="closable" @click="close">
... ... @@ -130,6 +130,10 @@
130 130 this.close();
131 131 }
132 132 },
  133 + handleWrapClick (event) {
  134 + // use indexOf,do not use === ,because ivu-modal-wrap can have other custom className
  135 + if (event.target.getAttribute('class').indexOf(`${prefixCls}-wrap`) > -1) this.mask();
  136 + },
133 137 cancel () {
134 138 this.close();
135 139 },
... ...
src/styles/mixins/mask.less
... ... @@ -6,6 +6,7 @@
6 6 right: 0;
7 7 background-color: rgba(55, 55, 55, 0.6);
8 8 height: 100%;
  9 + z-index: @zindex-modal;
9 10  
10 11 &-hidden {
11 12 display: none;
... ...
test/routers/more.vue
1   -<style>
2   - body{
3   - height: 2000px !important;
  1 +<style lang="less">
  2 + .vertical-center-modal{
  3 + display: flex;
  4 + align-items: center;
  5 + justify-content: center;
  6 +
  7 + .ivu-modal{
  8 + top: 0;
  9 + }
4 10 }
5 11 </style>
6 12 <template>
7   - <i-button type="primary" @click="modal1 = true">显示对话框</i-button>
8   - <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button>
9   - scrollable:{{scrollable}}
  13 + <i-button @click="modal9 = true">距离顶部 20px</i-button>
  14 + <Modal
  15 + title="对话框标题"
  16 + :visible.sync="modal9"
  17 + :style="{top: '20px'}">
  18 + <p>对话框内容</p>
  19 + <p>对话框内容</p>
  20 + <p>对话框内容</p>
  21 + </Modal>
  22 + <i-button @click="modal10 = true">垂直居中</i-button>
10 23 <Modal
11   - :visible.sync="modal1"
12   - title="普通的Modal对话框标题"
13   - :scrollable="scrollable"
14   - @on-ok="ok"
15   - @on-cancel="cancel">
  24 + title="对话框标题"
  25 + :visible.sync="modal10"
  26 + class-name="vertical-center-modal">
16 27 <p>对话框内容</p>
17 28 <p>对话框内容</p>
18 29 <p>对话框内容</p>
19   - <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button>
20 30 </Modal>
21 31 <i-button @click="instance(true)">Create Instance Scrollable</i-button>
22 32 <i-button @click="instance(false)">Create Instance Non-scrollable</i-button>
... ... @@ -25,6 +35,8 @@
25 35 export default {
26 36 data () {
27 37 return {
  38 + modal9: false,
  39 + modal10: false,
28 40 modal1: false,
29 41 scrollable: false
30 42 }
... ...