dpzvc-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/build-style.js +42 -0
- package/dist/dpzvc.js +17605 -0
- package/dist/styles/dpzvc.css +1 -0
- package/dist-prod/index.html +26 -0
- package/dist-prod/main.js +1 -0
- package/dist-prod/vendor.bundle.js +1 -0
- package/package.json +88 -0
- package/src/components/Indicator/Indicator.vue +77 -0
- package/src/components/Indicator/index.js +153 -0
- package/src/components/Text/Number.vue +201 -0
- package/src/components/Text/index.js +7 -0
- package/src/components/Text/textBar.vue +142 -0
- package/src/components/action-sheet/actionSheet.vue +91 -0
- package/src/components/action-sheet/index.js +5 -0
- package/src/components/app.vue +66 -0
- package/src/components/badge/badge.vue +77 -0
- package/src/components/badge/index.js +5 -0
- package/src/components/button/button.vue +122 -0
- package/src/components/button/index.js +5 -0
- package/src/components/card/card.vue +59 -0
- package/src/components/card/index.js +5 -0
- package/src/components/cell/cell.vue +103 -0
- package/src/components/cell/index.js +5 -0
- package/src/components/cell-swipe/cell-swipe.vue +148 -0
- package/src/components/cell-swipe/index.js +5 -0
- package/src/components/checkBox/checkbox-group.vue +76 -0
- package/src/components/checkBox/checkbox.vue +107 -0
- package/src/components/checkBox/index.js +8 -0
- package/src/components/header/header.vue +82 -0
- package/src/components/header/index.js +5 -0
- package/src/components/loadMore/index.js +5 -0
- package/src/components/loadMore/loadmore.vue +293 -0
- package/src/components/message/confirm.js +52 -0
- package/src/components/message/index.js +132 -0
- package/src/components/message/message.vue +135 -0
- package/src/components/message/messageGroup.vue +74 -0
- package/src/components/modal/confirm.js +161 -0
- package/src/components/modal/index.js +63 -0
- package/src/components/modal/modal.vue +144 -0
- package/src/components/picker/area-picker/area-picker.vue +223 -0
- package/src/components/picker/area-picker/props.js +17 -0
- package/src/components/picker/date-picker/date-picker.vue +291 -0
- package/src/components/picker/date-picker/props.js +24 -0
- package/src/components/picker/index.js +5 -0
- package/src/components/picker/normal-picker/normal-picker.vue +107 -0
- package/src/components/picker/normal-picker/props.js +20 -0
- package/src/components/picker/picker-slot.vue +206 -0
- package/src/components/picker/picker.vue +111 -0
- package/src/components/popup/index.js +5 -0
- package/src/components/popup/popup.vue +117 -0
- package/src/components/progress/index.js +5 -0
- package/src/components/progress/progress.vue +77 -0
- package/src/components/prompt/confirm.js +174 -0
- package/src/components/prompt/index.js +50 -0
- package/src/components/prompt/prompt.vue +166 -0
- package/src/components/radioBox/index.js +8 -0
- package/src/components/radioBox/radiobox-group.vue +74 -0
- package/src/components/radioBox/radiobox.vue +117 -0
- package/src/components/rater/index.js +5 -0
- package/src/components/rater/rater.vue +164 -0
- package/src/components/slideBar/index.js +6 -0
- package/src/components/slideBar/slideBar.vue +269 -0
- package/src/components/spinner/behavior/blade.vue +22 -0
- package/src/components/spinner/behavior/double-bounce.vue +22 -0
- package/src/components/spinner/behavior/fading-circle.vue +37 -0
- package/src/components/spinner/behavior/snake.vue +32 -0
- package/src/components/spinner/behavior/triple-bounce.vue +41 -0
- package/src/components/spinner/index.js +5 -0
- package/src/components/spinner/props.js +25 -0
- package/src/components/spinner/spinner.vue +74 -0
- package/src/components/swipe/index.js +5 -0
- package/src/components/swipe/swipe.vue +399 -0
- package/src/components/switchbar/index.js +5 -0
- package/src/components/switchbar/switchbar.vue +83 -0
- package/src/components/tab/index.js +6 -0
- package/src/components/tab/tab.vue +95 -0
- package/src/components/toTop/index.js +5 -0
- package/src/components/toTop/topTop.vue +76 -0
- package/src/components/upload/index.js +5 -0
- package/src/components/upload/upload.vue +200 -0
- package/src/config/config.js +17 -0
- package/src/directives/clickoutside.js +32 -0
- package/src/directives/tranferDom.js +65 -0
- package/src/index.js +83 -0
- package/src/lib/MegaPixImage.js +253 -0
- package/src/lib/exif.js +808 -0
- package/src/main.js +76 -0
- package/src/mixin/emitter.js +41 -0
- package/src/mixin/input.js +41 -0
- package/src/router.js +229 -0
- package/src/styles/base/font.less +99 -0
- package/src/styles/base/reset.less +69 -0
- package/src/styles/base/variable.less +108 -0
- package/src/styles/components/actionSheet.less +43 -0
- package/src/styles/components/badge.less +79 -0
- package/src/styles/components/button.less +123 -0
- package/src/styles/components/card.less +31 -0
- package/src/styles/components/cell-swipe.less +20 -0
- package/src/styles/components/cell.less +71 -0
- package/src/styles/components/checkBox.less +111 -0
- package/src/styles/components/editor.less +3 -0
- package/src/styles/components/header.less +70 -0
- package/src/styles/components/indicator.less +37 -0
- package/src/styles/components/loadmore.less +48 -0
- package/src/styles/components/message.less +57 -0
- package/src/styles/components/modal.less +82 -0
- package/src/styles/components/number.less +58 -0
- package/src/styles/components/picker.less +150 -0
- package/src/styles/components/popup.less +46 -0
- package/src/styles/components/progress.less +50 -0
- package/src/styles/components/prompt.less +37 -0
- package/src/styles/components/radioBox.less +136 -0
- package/src/styles/components/slide-Bar.less +147 -0
- package/src/styles/components/spinner.less +328 -0
- package/src/styles/components/swipe.less +125 -0
- package/src/styles/components/switchBar.less +88 -0
- package/src/styles/components/tab.less +69 -0
- package/src/styles/components/text.less +80 -0
- package/src/styles/components/toTop.less +26 -0
- package/src/styles/components/upload.less +23 -0
- package/src/styles/index.less +38 -0
- package/src/styles/utils/1px.less +204 -0
- package/src/styles/utils/animation.less +131 -0
- package/src/styles/utils/nowrap.less +19 -0
- package/src/template/index.ejs +26 -0
- package/src/utils/util.js +203 -0
- package/src/vconsole-resources.min.js +6 -0
- package/src/vconsole-sources.min.js +6 -0
- package/src/vconsole.min.js +7 -0
- package/src/views/ActionSheet.vue +33 -0
- package/src/views/Badge.vue +40 -0
- package/src/views/Button.vue +40 -0
- package/src/views/Card.vue +52 -0
- package/src/views/Cell.vue +21 -0
- package/src/views/CellSwipe.vue +85 -0
- package/src/views/CheckBox.vue +53 -0
- package/src/views/Header.vue +47 -0
- package/src/views/Indicator.vue +69 -0
- package/src/views/LoadMore.vue +54 -0
- package/src/views/Message.vue +42 -0
- package/src/views/Modal.vue +32 -0
- package/src/views/Picker.vue +50 -0
- package/src/views/Popup.vue +87 -0
- package/src/views/Progress.vue +32 -0
- package/src/views/Prompt.vue +31 -0
- package/src/views/RadioBox.vue +55 -0
- package/src/views/Rater.vue +39 -0
- package/src/views/SlideBar.vue +47 -0
- package/src/views/Spinner.vue +15 -0
- package/src/views/Swipe.vue +34 -0
- package/src/views/SwitchBar.vue +36 -0
- package/src/views/Tab.vue +41 -0
- package/src/views/Text.vue +64 -0
- package/src/views/ToTop.vue +17 -0
- package/src/views/Upload.vue +44 -0
- package/src/views/guide.vue +159 -0
- package/src/views/index.vue +435 -0
- package/webpack.base.config.js +74 -0
- package/webpack.dev.config.js +67 -0
- package/webpack.dist.dev.config.js +44 -0
- package/webpack.dist.prod.config.js +50 -0
- package/webpack.prod.config.js +72 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition name="dpzvc-ani-scale">
|
|
3
|
+
|
|
4
|
+
<div :class="classes">
|
|
5
|
+
<div :class="leftClasses" v-if="showLeft">
|
|
6
|
+
<slot name="message-left">
|
|
7
|
+
<Spinner size="65" type="blade" color="#ffffff"></Spinner>
|
|
8
|
+
</slot>
|
|
9
|
+
</div>
|
|
10
|
+
<p :class="wrapperClasses">{{text}}</p>
|
|
11
|
+
<div :class="rightClasses" v-if="!rightHide">
|
|
12
|
+
<slot name="message-right"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
</transition>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import Spinner from '../spinner'
|
|
21
|
+
const prefixCls = 'dpzvc-message';
|
|
22
|
+
const defaultDuration = 1;
|
|
23
|
+
export default {
|
|
24
|
+
|
|
25
|
+
data (){
|
|
26
|
+
return {}
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
name: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
text: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
duration: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 1.5
|
|
41
|
+
},
|
|
42
|
+
showLeft: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
rightHide: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: true
|
|
49
|
+
},
|
|
50
|
+
//TODO
|
|
51
|
+
type: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: 'normal',
|
|
54
|
+
validator: (val) => {
|
|
55
|
+
return ['success', 'loading', 'error', 'normal', 'warning', 'danger'].indexOf(val) > -1
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
onClose: {
|
|
59
|
+
type: Function,
|
|
60
|
+
default:function(){
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
position: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'top'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
components: {
|
|
70
|
+
Spinner
|
|
71
|
+
},
|
|
72
|
+
computed: {
|
|
73
|
+
classes(){
|
|
74
|
+
return [
|
|
75
|
+
|
|
76
|
+
`${prefixCls}`,
|
|
77
|
+
`${prefixCls}-position-${this.position}`
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
wrapperClasses(){
|
|
81
|
+
return [
|
|
82
|
+
`${prefixCls}-text`
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
leftClasses(){
|
|
86
|
+
return [
|
|
87
|
+
`${prefixCls}-left`
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
rightClasses(){
|
|
91
|
+
return [
|
|
92
|
+
`${prefixCls}-right`
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
methods: {
|
|
99
|
+
|
|
100
|
+
close(){
|
|
101
|
+
|
|
102
|
+
this.closeTimer();
|
|
103
|
+
this.$parent.remove(this.name);
|
|
104
|
+
this.onClose();
|
|
105
|
+
|
|
106
|
+
},
|
|
107
|
+
closeTimer(){
|
|
108
|
+
|
|
109
|
+
if (this.timer) {
|
|
110
|
+
clearTimeout(this.timer);
|
|
111
|
+
this.timer = null
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
mounted(){
|
|
118
|
+
|
|
119
|
+
this.closeTimer();
|
|
120
|
+
|
|
121
|
+
if (this.duration !== 0) {
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
this.timer = setTimeout(() => {
|
|
125
|
+
this.close();
|
|
126
|
+
}, this.duration * 1000);
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
beforeDestroy(){
|
|
131
|
+
this.closeTimer()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dpzvc-message-group" :style="styles">
|
|
3
|
+
<Message v-for="(message,key) in messages" :key="message.name"
|
|
4
|
+
:duration="message.duration"
|
|
5
|
+
:show-left="message.showLeft"
|
|
6
|
+
:right-hide="message.rightHide"
|
|
7
|
+
:name="message.name"
|
|
8
|
+
:type="message.type"
|
|
9
|
+
:text="message.text"
|
|
10
|
+
:position="message.position">
|
|
11
|
+
|
|
12
|
+
</Message>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
|
|
18
|
+
const prefixCls = 'dpzvc-message-group';
|
|
19
|
+
|
|
20
|
+
import Message from './message.vue'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name:'MessageGroup',
|
|
25
|
+
props:{
|
|
26
|
+
styles:{
|
|
27
|
+
type:Object,
|
|
28
|
+
default:()=>{
|
|
29
|
+
return {
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
data(){
|
|
36
|
+
return {
|
|
37
|
+
messages:[]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
methods:{
|
|
41
|
+
add(props){
|
|
42
|
+
|
|
43
|
+
let _prop = Object.assign({},{
|
|
44
|
+
text:'',
|
|
45
|
+
showLeft:false,
|
|
46
|
+
rightHide:true,
|
|
47
|
+
duration:1.5,
|
|
48
|
+
|
|
49
|
+
},props);
|
|
50
|
+
|
|
51
|
+
this.messages.push(_prop);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
remove(name){
|
|
55
|
+
|
|
56
|
+
const messages = this.messages;
|
|
57
|
+
|
|
58
|
+
messages.forEach((item,index)=>{
|
|
59
|
+
if(item.name===name){
|
|
60
|
+
this.messages.splice(index,1);
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
},
|
|
66
|
+
closeAll(){
|
|
67
|
+
this.messages = [];
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
components:{
|
|
71
|
+
Message
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by admin on 2017/3/30.
|
|
3
|
+
*/
|
|
4
|
+
import Modal from './modal.vue'
|
|
5
|
+
import VButton from '../button'
|
|
6
|
+
import Vue from 'vue'
|
|
7
|
+
|
|
8
|
+
import { camelcaseToHyphen } from '../../utils/util'
|
|
9
|
+
|
|
10
|
+
const prefixCls = 'dpzvc-modal';
|
|
11
|
+
|
|
12
|
+
Modal.newInstance = properties =>{
|
|
13
|
+
|
|
14
|
+
let _props = properties || {};
|
|
15
|
+
|
|
16
|
+
let props = '';
|
|
17
|
+
|
|
18
|
+
Object.keys(_props).forEach( prop =>{
|
|
19
|
+
|
|
20
|
+
props += ' :'+camelcaseToHyphen(prop) + '=' + prop
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const div = document.createElement('div');
|
|
24
|
+
|
|
25
|
+
document.body.appendChild(div);
|
|
26
|
+
|
|
27
|
+
const modal = new Vue({
|
|
28
|
+
el:div,
|
|
29
|
+
template:`<Modal ${props} v-model="visible" :width="width" >
|
|
30
|
+
<div class="${prefixCls}-header-inner ellipse-fir" v-html="title" slot="header"></div>
|
|
31
|
+
<div class="${prefixCls}-body-inner" v-html="body" slot="body"></div>
|
|
32
|
+
<template slot="footer">
|
|
33
|
+
<v-button type="primary" :radius="false" @click="cancle" v-if="showCancle">{{cancleText}}</v-button>
|
|
34
|
+
<v-button type="normal" :radius="false" @click="ok" :loading="buttonLoading">{{okText}}</v-button>
|
|
35
|
+
</template>
|
|
36
|
+
</Modal>`,
|
|
37
|
+
components:{
|
|
38
|
+
Modal,
|
|
39
|
+
VButton
|
|
40
|
+
},
|
|
41
|
+
data:Object.assign(_props,{
|
|
42
|
+
visible:false,
|
|
43
|
+
width:'70%',
|
|
44
|
+
body:'',
|
|
45
|
+
title:'',
|
|
46
|
+
okText:'确定',
|
|
47
|
+
cancleText:'取消',
|
|
48
|
+
loading:false,
|
|
49
|
+
buttonLoading:false,
|
|
50
|
+
showCancle:true,
|
|
51
|
+
showHead:true,
|
|
52
|
+
onOk:function(){},
|
|
53
|
+
onCancle:function(){},
|
|
54
|
+
onRemove:function(){}
|
|
55
|
+
}),
|
|
56
|
+
methods:{
|
|
57
|
+
cancle(){
|
|
58
|
+
this.$children[0].visible = false;
|
|
59
|
+
this.onCancle();
|
|
60
|
+
this.remove()
|
|
61
|
+
|
|
62
|
+
},
|
|
63
|
+
ok(){
|
|
64
|
+
console.log('asd')
|
|
65
|
+
if (this.loading) {
|
|
66
|
+
this.buttonLoading = true;
|
|
67
|
+
this.$children[0].buttonLoading = true;
|
|
68
|
+
} else {
|
|
69
|
+
this.visible = false;
|
|
70
|
+
this.remove();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.onOk()
|
|
74
|
+
},
|
|
75
|
+
remove(){
|
|
76
|
+
this.$children[0].visible = false;
|
|
77
|
+
setTimeout(()=>{
|
|
78
|
+
this.destroy();
|
|
79
|
+
},300)
|
|
80
|
+
},
|
|
81
|
+
destroy(){
|
|
82
|
+
|
|
83
|
+
this.$destroy();
|
|
84
|
+
document.body.removeChild(this.$el);
|
|
85
|
+
this.onRemove()
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
},
|
|
90
|
+
}).$children[0];
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
|
|
96
|
+
show(props){
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
// if ('width' in props) {
|
|
101
|
+
// modal.$parent.width = props.width
|
|
102
|
+
// }
|
|
103
|
+
//
|
|
104
|
+
// if ('title' in props) {
|
|
105
|
+
// modal.$parent.title = props.title
|
|
106
|
+
// }
|
|
107
|
+
//
|
|
108
|
+
// if ('showHead' in props) {
|
|
109
|
+
// modal.$parent.showHead = props.showHead
|
|
110
|
+
// }
|
|
111
|
+
//
|
|
112
|
+
// if ('okText' in props) {
|
|
113
|
+
// modal.$parent.okText = props.okText
|
|
114
|
+
// }
|
|
115
|
+
//
|
|
116
|
+
// if ('cancleText' in props) {
|
|
117
|
+
// modal.$parent.cancleText = props.cancleText
|
|
118
|
+
// }
|
|
119
|
+
//
|
|
120
|
+
//
|
|
121
|
+
// if ('onCancle' in props) {
|
|
122
|
+
// modal.$parent.onCancle = props.onCancle
|
|
123
|
+
// }
|
|
124
|
+
//
|
|
125
|
+
// if ('onOk' in props) {
|
|
126
|
+
// modal.$parent.onOk = props.onOk
|
|
127
|
+
// }
|
|
128
|
+
//
|
|
129
|
+
// if ('loading' in props) {
|
|
130
|
+
// modal.$parent.loading = props.loading
|
|
131
|
+
// }
|
|
132
|
+
//
|
|
133
|
+
// if ('body' in props) {
|
|
134
|
+
// modal.$parent.body = props.body
|
|
135
|
+
// }
|
|
136
|
+
|
|
137
|
+
Object.keys(props).forEach((item)=>{
|
|
138
|
+
modal.$parent[item] = props[item]
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
modal.$parent.showCancle = props.showCancle;
|
|
142
|
+
modal.$parent.onRemove = props.onRemove;
|
|
143
|
+
modal.visible = true;
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
},
|
|
147
|
+
remove () {
|
|
148
|
+
|
|
149
|
+
modal.visible = false;
|
|
150
|
+
modal.$parent.buttonLoading = false;
|
|
151
|
+
modal.$parent.remove();
|
|
152
|
+
|
|
153
|
+
},
|
|
154
|
+
component:modal
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
export default Modal
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by admin on 2017/3/30.
|
|
3
|
+
*/
|
|
4
|
+
import Modal from './confirm'
|
|
5
|
+
|
|
6
|
+
let modalInstance;
|
|
7
|
+
|
|
8
|
+
function getModalInstance(){
|
|
9
|
+
console.warn(modalInstance)
|
|
10
|
+
modalInstance = modalInstance || Modal.newInstance({
|
|
11
|
+
showHead:true,
|
|
12
|
+
closable:true,
|
|
13
|
+
maskClosable:false,
|
|
14
|
+
footerHide:false
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
return modalInstance
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
function confirm (options) {
|
|
23
|
+
|
|
24
|
+
let instance = getModalInstance();
|
|
25
|
+
|
|
26
|
+
options.onRemove = function (){
|
|
27
|
+
modalInstance = null;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
instance.show(options)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Modal.info = function (props={}){
|
|
37
|
+
|
|
38
|
+
props.showCancle = true;
|
|
39
|
+
props.showHead = false;
|
|
40
|
+
return confirm(props)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Modal.confirm = function (props={}) {
|
|
44
|
+
|
|
45
|
+
props.showCancle = false;
|
|
46
|
+
props.showHead = false;
|
|
47
|
+
|
|
48
|
+
return confirm(props)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Modal.remove = function(){
|
|
52
|
+
|
|
53
|
+
if(!modalInstance){
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const instance = getModalInstance();
|
|
58
|
+
|
|
59
|
+
instance.remove();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export default Modal;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<transition name="dpzvc-ani-fade">
|
|
4
|
+
<div class="dpzvc-modal-mask" v-show="visible" @click="mask" @touchstart.prevent @touchmove.prevent @touchend.prevent></div>
|
|
5
|
+
</transition>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<transition name="dpzvc-ani-scale">
|
|
10
|
+
<div class="dpzvc-modal " :style="getWrapperStyle" v-show="visible" >
|
|
11
|
+
<div class="dpzvc-modal-header" v-if="isHead"><slot name="header"><div slot="header" class="dpzvc-modal-header-inner ellipse-fir">{{title}}</div></slot></div>
|
|
12
|
+
<div class="dpzvc-modal-body"><slot name="body">{{body}}</slot></div>
|
|
13
|
+
<div class="dpzvc-modal-footer" v-if="!footerHide">
|
|
14
|
+
<slot name="footer">
|
|
15
|
+
<v-button type="primary" @click="close" v-if="cancleText">{{cancleText}}</v-button>
|
|
16
|
+
<v-button type="normal" @click="ok" :loading="buttonLoading">{{okText}}</v-button>
|
|
17
|
+
</slot>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</transition>
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import Emitter from '../../mixin/emitter'
|
|
27
|
+
import VButton from '../button'
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name:'Modal',
|
|
31
|
+
mixins:[Emitter],
|
|
32
|
+
|
|
33
|
+
props:{
|
|
34
|
+
value: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
maskClosable: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: true
|
|
41
|
+
},
|
|
42
|
+
title: {
|
|
43
|
+
type: String
|
|
44
|
+
},
|
|
45
|
+
width: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '70%'
|
|
48
|
+
},
|
|
49
|
+
okText: {
|
|
50
|
+
type: String,
|
|
51
|
+
default () {
|
|
52
|
+
return '确定';
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
cancleText: {
|
|
56
|
+
type: String,
|
|
57
|
+
default () {
|
|
58
|
+
return '取消';
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
loading: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
styles: {
|
|
66
|
+
type: Object
|
|
67
|
+
},
|
|
68
|
+
showHead:{
|
|
69
|
+
type:Boolean,
|
|
70
|
+
default:true
|
|
71
|
+
},
|
|
72
|
+
footerHide: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
},
|
|
76
|
+
body:String
|
|
77
|
+
},
|
|
78
|
+
data(){
|
|
79
|
+
return {
|
|
80
|
+
isHead:this.showHead,
|
|
81
|
+
visible:this.value,
|
|
82
|
+
buttonLoading:false
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
components:{
|
|
87
|
+
VButton
|
|
88
|
+
},
|
|
89
|
+
computed:{
|
|
90
|
+
getWrapperStyle(){
|
|
91
|
+
|
|
92
|
+
let style = {};
|
|
93
|
+
|
|
94
|
+
let styleWidth = {
|
|
95
|
+
|
|
96
|
+
width: `${this.width}`
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let customStyle = this.styles ? this.styles:{}
|
|
100
|
+
|
|
101
|
+
Object.assign(style, styleWidth, customStyle);
|
|
102
|
+
|
|
103
|
+
return style;
|
|
104
|
+
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
},
|
|
108
|
+
methods:{
|
|
109
|
+
close(){
|
|
110
|
+
|
|
111
|
+
this.visible = false;
|
|
112
|
+
this.$emit('on-cancle')
|
|
113
|
+
},
|
|
114
|
+
mask(){
|
|
115
|
+
if (!this.maskClosable && !this.buttonLoading) {
|
|
116
|
+
this.close()
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
},
|
|
120
|
+
ok(){
|
|
121
|
+
|
|
122
|
+
if (this.loading) {
|
|
123
|
+
|
|
124
|
+
this.buttonLoading = true;
|
|
125
|
+
} else {
|
|
126
|
+
|
|
127
|
+
this.visible = false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
this.$emit('on-ok')
|
|
131
|
+
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
watch:{
|
|
135
|
+
value(val) {
|
|
136
|
+
this.visible = val
|
|
137
|
+
},
|
|
138
|
+
showHead(val){
|
|
139
|
+
this.isHead = val
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
</script>
|