dpzvc-ui 1.2.2 → 1.2.4
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/build-style.js +11 -22
- package/dist/dpzvc.esm.js +471 -555
- package/dist/dpzvc.esm.js.map +1 -1
- package/dist/dpzvc.esm.min.js +1 -1
- package/dist/dpzvc.esm.min.js.map +1 -1
- package/dist/dpzvc.js +449 -574
- package/dist/dpzvc.js.map +1 -1
- package/dist/dpzvc.min.js +1 -1
- package/dist/dpzvc.min.js.map +1 -1
- package/dist-prod/445.02e4c5b08288b0d23ede.js +3 -0
- package/dist-prod/445.02e4c5b08288b0d23ede.js.LICENSE.txt +5 -0
- package/dist-prod/445.02e4c5b08288b0d23ede.js.map +1 -0
- package/dist-prod/index.html +1 -1
- package/dist-prod/main.992de223adbd07b6b84b.js +2 -0
- package/dist-prod/main.992de223adbd07b6b84b.js.map +1 -0
- package/dist-prod/rater.2a701809bfde6325d1a2.chunk.js +2 -0
- package/dist-prod/rater.2a701809bfde6325d1a2.chunk.js.map +1 -0
- package/package.json +2 -1
- package/src/components/Indicator/index.js +58 -123
- package/src/components/modal/confirm.js +106 -153
- package/src/components/prompt/confirm.js +70 -169
- package/src/components/upload/upload.vue +1 -1
- package/src/lib/MegaPixImage.js +126 -122
- package/src/lib/MegaPixImageOld.js +157 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(self.webpackChunkdpzvc_ui=self.webpackChunkdpzvc_ui||[]).push([[109],{4142(n,e,t){var a=t(6795);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[n.id,a,""]]),a.locals&&(n.exports=a.locals);(0,t(534).A)("6ceb7c19",a,!0,{})},6795(n,e,t){"use strict";t.r(e),t.d(e,{default:()=>r});var a=t(1354),i=t.n(a),s=t(6314),A=t.n(s)()(i());A.push([n.id,".Rater[data-v-3763261e] {\n width: 100%;\n padding-top: 50px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n.Rater p[data-v-3763261e] {\n text-indent: 10px;\n font-weight: bold;\n font-size: 14px;\n margin: 10px 0;\n}\n/*# sourceMappingURL=Rater.css.map */","",{version:3,sources:["webpack://./Rater.vue","webpack://./src/views/Rater.vue"],names:[],mappings:"AACA;EACI,WAAA;EACA,iBAAA;EACA,aAAA;EACA,sBAAA;EACA,uBAAA;EACA,mBAAA;ACAJ;ADNA;EAQQ,iBAAA;EACA,iBAAA;EACA,eAAA;EACA,cAAA;ACCR;AACA,oCAAoC",sourcesContent:["\n.Rater {\n width: 100%;\n padding-top: 50px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n p {\n text-indent: 10px;\n font-weight: bold;\n font-size: 14px;\n margin: 10px 0;\n }\n}\n",".Rater {\n width: 100%;\n padding-top: 50px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n.Rater p {\n text-indent: 10px;\n font-weight: bold;\n font-size: 14px;\n margin: 10px 0;\n}\n/*# sourceMappingURL=Rater.css.map */"],sourceRoot:""}]);const r=A},9123(n,e,t){"use strict";t.r(e),t.d(e,{default:()=>i});const a={name:"rater",data:function(){return{rate:0,disabledRate:4.5}}};t(4142);const i=(0,t(4486).A)(a,function(){var n=this,e=n._self._c;return e("div",{staticClass:"Rater"},[e("p",[n._v("可点击评分")]),n._v(" "),e("Rater",{model:{value:n.rate,callback:function(e){n.rate=e},expression:"rate"}}),n._v(" "),e("span",[n._v(n._s(n.rate))]),n._v(" "),e("p",[n._v("不可点击评分")]),n._v(" "),e("Rater",{attrs:{disabled:""},model:{value:n.disabledRate,callback:function(e){n.disabledRate=e},expression:"disabledRate"}}),n._v(" "),e("span",[n._v(n._s(n.disabledRate))])],1)},[],!1,null,"3763261e",null).exports}}]);
|
|
2
|
+
//# sourceMappingURL=rater.2a701809bfde6325d1a2.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rater.2a701809bfde6325d1a2.chunk.js","mappings":"mFAGA,IAAIA,EAAU,EAAQ,MACnBA,EAAQC,aAAYD,EAAUA,EAAQE,SACnB,iBAAZF,IAAsBA,EAAU,CAAC,CAACG,EAAOC,GAAIJ,EAAS,MAC7DA,EAAQK,SAAQF,EAAOG,QAAUN,EAAQK,SAG/BE,EADH,UACO,WAAYP,GAAS,EAAM,CAAC,E,0FCNzCQ,E,MAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACN,EAAOC,GAAI,gUAcD,GAAG,CAAC,QAAU,EAAE,QAAU,CAAC,wBAAwB,mCAAmC,MAAQ,GAAG,SAAW,4IAA4I,eAAiB,CAAC,gSAAgS,+RAA+R,WAAa,MAE93B,S,yDCTA,MCZqK,EDYrK,CACAM,KAAA,QACAC,KAAA,WACA,OACAC,KAAA,EACAC,aAAA,IAEA,G,QEAA,SAXgB,E,QAAA,GACd,ECTW,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,SAAS,CAACF,EAAG,IAAI,CAACF,EAAIK,GAAG,WAAWL,EAAIK,GAAG,KAAKH,EAAG,QAAQ,CAACI,MAAM,CAACC,MAAOP,EAAIF,KAAMU,SAAS,SAAUC,GAAMT,EAAIF,KAAKW,CAAG,EAAEC,WAAW,UAAUV,EAAIK,GAAG,KAAKH,EAAG,OAAO,CAACF,EAAIK,GAAGL,EAAIW,GAAGX,EAAIF,SAASE,EAAIK,GAAG,KAAKH,EAAG,IAAI,CAACF,EAAIK,GAAG,YAAYL,EAAIK,GAAG,KAAKH,EAAG,QAAQ,CAACU,MAAM,CAAC,SAAW,IAAIN,MAAM,CAACC,MAAOP,EAAID,aAAcS,SAAS,SAAUC,GAAMT,EAAID,aAAaU,CAAG,EAAEC,WAAW,kBAAkBV,EAAIK,GAAG,KAAKH,EAAG,OAAO,CAACF,EAAIK,GAAGL,EAAIW,GAAGX,EAAID,kBAAkB,EACvhB,EACsB,IDUpB,EACA,KACA,WACA,M","sources":["webpack://dpzvc-ui/./src/views/Rater.vue?5a04","webpack://dpzvc-ui/./src/views/Rater.vue?3465","webpack://dpzvc-ui/src/views/Rater.vue","webpack://dpzvc-ui/./src/views/Rater.vue?6ab8","webpack://dpzvc-ui/./src/views/Rater.vue?bbed","webpack://dpzvc-ui/./src/views/Rater.vue"],"sourcesContent":["// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = require(\"!!../../node_modules/css-loader/dist/cjs.js??clonedRuleSet-3.use[1]!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/dist/cjs.js!../../node_modules/less-loader/dist/cjs.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Rater.vue?vue&type=style&index=0&id=3763261e&prod&lang=less&scoped=true\");\nif(content.__esModule) content = content.default;\nif(typeof content === 'string') content = [[module.id, content, '']];\nif(content.locals) module.exports = content.locals;\n// add the styles to the DOM\nvar add = require(\"!../../node_modules/vue-style-loader/lib/addStylesClient.js\").default\nvar update = add(\"6ceb7c19\", content, true, {});","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.Rater[data-v-3763261e] {\n width: 100%;\n padding-top: 50px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n.Rater p[data-v-3763261e] {\n text-indent: 10px;\n font-weight: bold;\n font-size: 14px;\n margin: 10px 0;\n}\n/*# sourceMappingURL=Rater.css.map */`, \"\",{\"version\":3,\"sources\":[\"webpack://./Rater.vue\",\"webpack://./src/views/Rater.vue\"],\"names\":[],\"mappings\":\"AACA;EACI,WAAA;EACA,iBAAA;EACA,aAAA;EACA,sBAAA;EACA,uBAAA;EACA,mBAAA;ACAJ;ADNA;EAQQ,iBAAA;EACA,iBAAA;EACA,eAAA;EACA,cAAA;ACCR;AACA,oCAAoC\",\"sourcesContent\":[\"\\n.Rater {\\n width: 100%;\\n padding-top: 50px;\\n display: flex;\\n flex-direction: column;\\n justify-content: center;\\n align-items: center;\\n p {\\n text-indent: 10px;\\n font-weight: bold;\\n font-size: 14px;\\n margin: 10px 0;\\n }\\n}\\n\",\".Rater {\\n width: 100%;\\n padding-top: 50px;\\n display: flex;\\n flex-direction: column;\\n justify-content: center;\\n align-items: center;\\n}\\n.Rater p {\\n text-indent: 10px;\\n font-weight: bold;\\n font-size: 14px;\\n margin: 10px 0;\\n}\\n/*# sourceMappingURL=Rater.css.map */\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","<template>\n <div class=\"Rater\">\n <p>可点击评分</p>\n <Rater v-model=\"rate\"></Rater>\n <span>{{rate}}</span>\n <p>不可点击评分</p>\n <Rater v-model=\"disabledRate\" disabled></Rater>\n <span>{{disabledRate}}</span>\n </div>\n</template>\n\n<script>\n export default {\n name: \"rater\",\n data(){\n return {\n rate:0,\n disabledRate:4.5\n }\n }\n }\n</script>\n\n<style lang=\"less\" scoped>\n .Rater {\n width: 100%;\n padding-top: 50px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n p {\n text-indent: 10px;\n font-weight: bold;\n font-size: 14px;\n margin: 10px 0;\n }\n }\n</style>","import mod from \"-!../../node_modules/babel-loader/lib/index.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Rater.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../node_modules/babel-loader/lib/index.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Rater.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./Rater.vue?vue&type=template&id=3763261e&scoped=true\"\nimport script from \"./Rater.vue?vue&type=script&lang=js\"\nexport * from \"./Rater.vue?vue&type=script&lang=js\"\nimport style0 from \"./Rater.vue?vue&type=style&index=0&id=3763261e&prod&lang=less&scoped=true\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"3763261e\",\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"Rater\"},[_c('p',[_vm._v(\"可点击评分\")]),_vm._v(\" \"),_c('Rater',{model:{value:(_vm.rate),callback:function ($$v) {_vm.rate=$$v},expression:\"rate\"}}),_vm._v(\" \"),_c('span',[_vm._v(_vm._s(_vm.rate))]),_vm._v(\" \"),_c('p',[_vm._v(\"不可点击评分\")]),_vm._v(\" \"),_c('Rater',{attrs:{\"disabled\":\"\"},model:{value:(_vm.disabledRate),callback:function ($$v) {_vm.disabledRate=$$v},expression:\"disabledRate\"}}),_vm._v(\" \"),_c('span',[_vm._v(_vm._s(_vm.disabledRate))])],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }"],"names":["content","__esModule","default","module","id","locals","exports","add","___CSS_LOADER_EXPORT___","push","name","data","rate","disabledRate","_vm","this","_c","_self","staticClass","_v","model","value","callback","$$v","expression","_s","attrs"],"ignoreList":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dpzvc-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Vue组件库",
|
|
5
5
|
"main": "dist/dpzvc.js",
|
|
6
6
|
"module": "dist/dpzvc.esm.js",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"babel-runtime": "^6.26.0",
|
|
48
48
|
"cross-env": "^3.1.4",
|
|
49
49
|
"css-loader": "^6.11.0",
|
|
50
|
+
"del": "^8.0.1",
|
|
50
51
|
"eslint": "^3.12.2",
|
|
51
52
|
"eslint-plugin-html": "^1.7.0",
|
|
52
53
|
"exif-js": "^2.2.1",
|
|
@@ -1,153 +1,88 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Indicator - Vue 2.7 CLI 适配版
|
|
3
3
|
*/
|
|
4
|
-
import Indicator from './Indicator'
|
|
5
|
-
import {camelcaseToHyphen} from '../../utils/util'
|
|
6
|
-
import Vue from 'vue'
|
|
7
|
-
let instance;
|
|
8
|
-
|
|
9
|
-
Indicator.newInstance = properties => {
|
|
10
|
-
|
|
11
|
-
let _props = properties || {};
|
|
12
|
-
|
|
13
|
-
let props = '';
|
|
14
|
-
|
|
15
|
-
Object.keys(_props).forEach(prop => {
|
|
16
|
-
|
|
17
|
-
props += ' :' + camelcaseToHyphen(prop) + '=' + prop
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const div = document.createElement('div');
|
|
21
|
-
|
|
22
|
-
document.body.appendChild(div);
|
|
23
|
-
|
|
24
|
-
let indicator = new Vue({
|
|
25
|
-
el: div,
|
|
26
|
-
template: `<Indicator ${props} v-model="visible" ></Indicator>`,
|
|
27
|
-
components: {
|
|
28
|
-
Indicator
|
|
29
|
-
},
|
|
30
|
-
data: Object.assign(_props, {
|
|
31
|
-
visible: false,
|
|
32
|
-
size: 45,
|
|
33
|
-
type: 'snake',
|
|
34
|
-
color: '#ffffff',
|
|
35
|
-
text: '加载中...',
|
|
36
|
-
onRemove:function(){}
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
methods: {
|
|
40
|
-
remove() {
|
|
41
|
-
this.$children[0].visible = false;
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
this.destroy();
|
|
44
|
-
}, 300)
|
|
45
|
-
},
|
|
46
|
-
destroy(){
|
|
47
4
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// if (!this.$el) return;
|
|
51
|
-
document.body.removeChild(this.$el);
|
|
52
|
-
this.onRemove()
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}).$children[0];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
open(options){
|
|
60
|
-
|
|
61
|
-
indicator.$parent.visible = true;
|
|
62
|
-
indicator.$parent.onRemove = options.onRemove;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if ('size' in options) {
|
|
66
|
-
indicator.$parent.size = options.size;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if ('type' in options) {
|
|
70
|
-
indicator.$parent.type = options.type;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if ('color' in options) {
|
|
74
|
-
indicator.$parent.color = options.color;
|
|
75
|
-
}
|
|
5
|
+
import Vue from 'vue'
|
|
6
|
+
import Indicator from './Indicator.vue'
|
|
76
7
|
|
|
77
|
-
|
|
78
|
-
indicator.$parent.text = options.text;
|
|
79
|
-
}
|
|
8
|
+
let instance = null
|
|
80
9
|
|
|
81
|
-
|
|
10
|
+
function createInstance(props = {}) {
|
|
11
|
+
const IndicatorConstructor = Vue.extend(Indicator)
|
|
82
12
|
|
|
83
|
-
|
|
13
|
+
const vm = new IndicatorConstructor({
|
|
14
|
+
propsData: {
|
|
15
|
+
size: 45,
|
|
16
|
+
type: 'snake',
|
|
17
|
+
color: '#ffffff',
|
|
18
|
+
text: '加载中...',
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
})
|
|
84
22
|
|
|
85
|
-
|
|
23
|
+
vm.$mount()
|
|
24
|
+
document.body.appendChild(vm.$el)
|
|
86
25
|
|
|
87
|
-
|
|
26
|
+
vm.visible = false
|
|
88
27
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
28
|
+
vm.$on('remove', () => {
|
|
29
|
+
destroyInstance()
|
|
30
|
+
})
|
|
93
31
|
|
|
32
|
+
return vm
|
|
33
|
+
}
|
|
94
34
|
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
35
|
+
function destroyInstance() {
|
|
36
|
+
if (!instance) return
|
|
37
|
+
instance.$destroy()
|
|
38
|
+
if (instance.$el && instance.$el.parentNode) {
|
|
39
|
+
instance.$el.parentNode.removeChild(instance.$el)
|
|
40
|
+
}
|
|
41
|
+
instance = null
|
|
42
|
+
}
|
|
102
43
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
44
|
+
function open(options = {}) {
|
|
45
|
+
if (!instance) {
|
|
46
|
+
instance = createInstance(options)
|
|
47
|
+
}
|
|
106
48
|
|
|
107
|
-
|
|
49
|
+
Object.keys(options).forEach(key => {
|
|
50
|
+
instance.$props[key] = options[key]
|
|
51
|
+
})
|
|
108
52
|
|
|
53
|
+
instance.visible = true
|
|
109
54
|
}
|
|
110
55
|
|
|
56
|
+
function close() {
|
|
57
|
+
if (!instance) return
|
|
58
|
+
instance.visible = false
|
|
59
|
+
destroyInstance()
|
|
60
|
+
}
|
|
111
61
|
|
|
112
|
-
|
|
62
|
+
/* ================== 对外 API ================== */
|
|
113
63
|
|
|
114
|
-
|
|
115
|
-
return confirm(props)
|
|
116
|
-
}
|
|
64
|
+
Indicator.open = open
|
|
117
65
|
|
|
66
|
+
Indicator.remove = close
|
|
118
67
|
|
|
119
68
|
Indicator.snake = function (props = {}) {
|
|
69
|
+
props.type = 'snake'
|
|
70
|
+
open(props)
|
|
71
|
+
}
|
|
120
72
|
|
|
121
|
-
|
|
122
|
-
|
|
73
|
+
Indicator.blade = function (props = {}) {
|
|
74
|
+
props.type = 'blade'
|
|
75
|
+
open(props)
|
|
123
76
|
}
|
|
124
77
|
|
|
125
78
|
Indicator.circle = function (props = {}) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return confirm(props)
|
|
79
|
+
props.type = 'fading-circle'
|
|
80
|
+
open(props)
|
|
129
81
|
}
|
|
130
82
|
|
|
131
83
|
Indicator.bounce = function (props = {}) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return confirm(props)
|
|
84
|
+
props.type = 'double-bounce'
|
|
85
|
+
open(props)
|
|
135
86
|
}
|
|
136
87
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (!instance) return false;
|
|
141
|
-
|
|
142
|
-
instance = instance || Indicator.newInstance({
|
|
143
|
-
size: 45,
|
|
144
|
-
color: '#ffffff',
|
|
145
|
-
text: '正在加载...',
|
|
146
|
-
type: 'snake'
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
instance.remove()
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
export default Indicator
|
|
88
|
+
export default Indicator
|
|
@@ -1,161 +1,114 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* confirm.js - 适配 Vue 2.7 runtime-only
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { camelcaseToHyphen } from '../../utils/util'
|
|
4
|
+
import Vue from 'vue';
|
|
5
|
+
import Modal from './modal.vue';
|
|
6
|
+
import VButton from '../button';
|
|
7
|
+
import { camelcaseToHyphen } from '../../utils/util';
|
|
9
8
|
|
|
10
9
|
const prefixCls = 'dpzvc-modal';
|
|
11
10
|
|
|
12
|
-
Modal.newInstance = properties
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
11
|
+
Modal.newInstance = function(properties = {}) {
|
|
12
|
+
// 创建一个新的 Vue 构造函数
|
|
13
|
+
const ModalConstructor = Vue.extend({
|
|
14
|
+
components: { Modal, VButton },
|
|
15
|
+
data() {
|
|
16
|
+
return Object.assign({
|
|
17
|
+
visible: false,
|
|
18
|
+
width: '70%',
|
|
19
|
+
body: '',
|
|
20
|
+
title: '',
|
|
21
|
+
okText: '确定',
|
|
22
|
+
cancleText: '取消',
|
|
23
|
+
loading: false,
|
|
24
|
+
buttonLoading: false,
|
|
25
|
+
showCancle: true,
|
|
26
|
+
showHead: true,
|
|
27
|
+
onOk: () => {},
|
|
28
|
+
onCancle: () => {},
|
|
29
|
+
onRemove: () => {}
|
|
30
|
+
}, properties);
|
|
31
|
+
},
|
|
32
|
+
render(h) {
|
|
33
|
+
const footer = [
|
|
34
|
+
this.showCancle
|
|
35
|
+
? h('v-button', {
|
|
36
|
+
props: { type: 'primary', radius: false },
|
|
37
|
+
on: { click: this.cancle }
|
|
38
|
+
}, this.cancleText)
|
|
39
|
+
: null,
|
|
40
|
+
h('v-button', {
|
|
41
|
+
props: { type: 'normal', radius: false, loading: this.buttonLoading },
|
|
42
|
+
on: { click: this.ok }
|
|
43
|
+
}, this.okText)
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
return h(Modal, {
|
|
47
|
+
props: {
|
|
48
|
+
value: this.visible,
|
|
49
|
+
width: this.width,
|
|
50
|
+
showHead: this.showHead,
|
|
51
|
+
footerHide: false
|
|
153
52
|
},
|
|
154
|
-
|
|
155
|
-
|
|
53
|
+
on: {
|
|
54
|
+
'on-ok': this.ok,
|
|
55
|
+
'on-cancle': this.cancle
|
|
56
|
+
}
|
|
57
|
+
}, [
|
|
58
|
+
h('div', { slot: 'header', domProps: { innerHTML: this.title }, class: `${prefixCls}-header-inner ellipse-fir` }),
|
|
59
|
+
h('div', { slot: 'body', domProps: { innerHTML: this.body }, class: `${prefixCls}-body-inner` }),
|
|
60
|
+
h('template', { slot: 'footer' }, footer)
|
|
61
|
+
]);
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
cancle() {
|
|
65
|
+
this.visible = false;
|
|
66
|
+
this.onCancle();
|
|
67
|
+
this.remove();
|
|
68
|
+
},
|
|
69
|
+
ok() {
|
|
70
|
+
if (this.loading) {
|
|
71
|
+
this.buttonLoading = true;
|
|
72
|
+
} else {
|
|
73
|
+
this.visible = false;
|
|
74
|
+
this.remove();
|
|
75
|
+
}
|
|
76
|
+
this.onOk();
|
|
77
|
+
},
|
|
78
|
+
remove() {
|
|
79
|
+
this.visible = false;
|
|
80
|
+
setTimeout(() => this.destroy(), 300);
|
|
81
|
+
},
|
|
82
|
+
destroy() {
|
|
83
|
+
this.$destroy();
|
|
84
|
+
if (this.$el && this.$el.parentNode) {
|
|
85
|
+
this.$el.parentNode.removeChild(this.$el);
|
|
86
|
+
}
|
|
87
|
+
this.onRemove();
|
|
88
|
+
}
|
|
156
89
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// 实例化并挂载到 DOM
|
|
93
|
+
const div = document.createElement('div');
|
|
94
|
+
document.body.appendChild(div);
|
|
95
|
+
const instance = new ModalConstructor().$mount(div);
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
show(props = {}) {
|
|
99
|
+
Object.keys(props).forEach(key => {
|
|
100
|
+
if (key in instance) {
|
|
101
|
+
instance[key] = props[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
instance.visible = true;
|
|
105
|
+
},
|
|
106
|
+
remove() {
|
|
107
|
+
instance.remove();
|
|
108
|
+
},
|
|
109
|
+
component: instance
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default Modal;
|
|
160
114
|
|
|
161
|
-
export default Modal
|