-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.js
42 lines (36 loc) · 1.22 KB
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
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
import Confirm from './';
export default configs => {
configs.children.push('confirm');
configs.components.Confirm = Confirm;
return (Vue, vm) => {
var opts = {
title: '',
content: '',
confirm: null,
cancel: null,
btn1: '取消',
btn2: '确定'
};
Vue.prototype.$Confirm = (title, confirm, cancel, options) => {
if (typeof title === 'string') {
options = options || {};
options.title = title;
} else if (typeof title === 'object') {
options = title;
}
if (typeof confirm === 'function') {
options = options || {};
options.confirm = confirm;
} else if (typeof confirm === 'object') {
options = Object.assign(options, confirm);
}
if (typeof cancel === 'function') {
options = options || {};
options.cancel = cancel;
} else if (typeof cancel === 'object') {
options = Object.assign(options, cancel);
}
vm.$refs.confirm._show(Object.assign({}, opts, options));
};
}
}