You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
876 B
41 lines
876 B
|
3 years ago
|
import config from './config';
|
||
|
|
import extend from './utils/extend';
|
||
|
|
import emitPageMixin from './mixins/emitPageMixin';
|
||
|
|
import gobalMixin from './mixins/gobalMixin';
|
||
|
|
import { replaceUniLoading, replaceUniModal, replaceUniToast } from './plugins/uni';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @description: vue插件
|
||
|
|
* @param {Vue} Vue
|
||
|
|
* @param {config} options
|
||
|
|
* @return {void}
|
||
|
|
*/
|
||
|
|
function install(Vue, options = {}) {
|
||
|
|
if (!Vue.prototype.toJSON) {
|
||
|
|
Vue.prototype.toJSON = function () { };
|
||
|
|
}
|
||
|
|
extend(config, options);
|
||
|
|
// 页面mixin
|
||
|
|
Vue.mixin(gobalMixin);
|
||
|
|
// onEmitPage生命周期
|
||
|
|
if (config.useEmitPageMixin) {
|
||
|
|
Vue.mixin(emitPageMixin);
|
||
|
|
}
|
||
|
|
if (config.replaceUniLoading) {
|
||
|
|
replaceUniLoading();
|
||
|
|
}
|
||
|
|
if (config.replaceUniToast) {
|
||
|
|
replaceUniToast();
|
||
|
|
}
|
||
|
|
if (config.replaceUniModal) {
|
||
|
|
replaceUniModal();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const sUi = {
|
||
|
|
config,
|
||
|
|
install,
|
||
|
|
};
|
||
|
|
|
||
|
|
export default sUi;
|