Merge pull request #2 from iview/master

合并原作者更新
This commit is contained in:
GITleonine1989 2017-02-21 17:32:54 +08:00 committed by GitHub
commit 14ad333882
4 changed files with 32 additions and 26 deletions

View file

@ -34,7 +34,7 @@
const iconPrefixCls = 'ivu-icon';
function isValueNumber (value) {
return (/(^-?[0-9]+\.{1}\d+$)|(^-?[1-9][0-9]*$)/).test(value + '');
return (/(^-?[0-9]+\.{1}\d+$)|(^-?[1-9][0-9]*$)|(^-?0{1}$)/).test(value + '');
}
function addNum (num1, num2) {
let sq1, sq2, m;

View file

@ -1,6 +1,6 @@
<template>
<div :class="wrapClasses">
<div :class="maskClasses" v-show="visible" @click="mask" transition="fade"></div>
<div :class="wrapClasses" @click="handleWrapClick">
<div :class="classes" :style="styles" v-show="visible" transition="ease">
<div :class="[prefixCls + '-content']">
<a :class="[prefixCls + '-close']" v-if="closable" @click="close">
@ -130,6 +130,10 @@
this.close();
}
},
handleWrapClick (event) {
// use indexOf,do not use === ,because ivu-modal-wrap can have other custom className
if (event.target.getAttribute('class').indexOf(`${prefixCls}-wrap`) > -1) this.mask();
},
cancel () {
this.close();
},

View file

@ -6,6 +6,7 @@
right: 0;
background-color: rgba(55, 55, 55, 0.6);
height: 100%;
z-index: @zindex-modal;
&-hidden {
display: none;

View file

@ -1,39 +1,40 @@
<style>
body{
height: 2000px !important;
<style lang="less">
.vertical-center-modal{
display: flex;
align-items: center;
justify-content: center;
.ivu-modal{
top: 0;
}
}
</style>
<template>
<i-button type="primary" @click="modal1 = true">显示对话框</i-button>
<i-button @click="scrollable = !scrollable">Toggle scrollable</i-button>
scrollable:{{scrollable}}
<i-button @click="modal9 = true">距离顶部 20px</i-button>
<Modal
:visible.sync="modal1"
title="普通的Modal对话框标题"
:scrollable="scrollable"
@on-ok="ok"
@on-cancel="cancel">
title="对话框标题"
:visible.sync="modal9"
:style="{top: '20px'}">
<p>对话框内容</p>
<p>对话框内容</p>
<p>对话框内容</p>
</Modal>
<i-button @click="modal10 = true">垂直居中</i-button>
<Modal
title="对话框标题"
:visible.sync="modal10"
class-name="vertical-center-modal">
<p>对话框内容</p>
<p>对话框内容</p>
<p>对话框内容</p>
<i-button @click="scrollable = !scrollable">Toggle scrollable</i-button>
</Modal>
</template>
<script>
export default {
data () {
return {
modal1: false,
scrollable: false
}
},
methods: {
ok () {
this.$nextTick(() => this.modal1 = true);
this.$Message.info('点击了确定');
},
cancel () {
this.$Message.info('点击了取消');
modal9: false,
modal10: false,
}
}
}