-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.js
33 lines (28 loc) · 933 Bytes
/
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
import Alert from './';
export default configs => {
configs.children.push('alert');
configs.components.Alert = Alert;
return (Vue, vm) => {
var opts = {
title: '',
content: '',
callback: null,
button: '确定'
};
Vue.prototype.$Alert = (title, callback, options) => {
if (typeof title === 'string') {
options = options || {};
options.title = title;
} else if (typeof title === 'object') {
options = title;
}
if (typeof callback === 'function') {
options = options || {};
options.callback = callback;
} else if (typeof callback === 'object') {
options = Object.assign(options, callback);
}
vm.$refs.alert._show(Object.assign({}, opts, options));
};
}
}