uni-query
Version:
🐠 为uniapp设计的开源组件库,专注最重要的核心组件
40 lines (35 loc) • 780 B
text/typescript
import getSystemInfo from "./getSystemInfo";
import getLocation from "./getLocation";
import saveAlbum from "./saveAlbum";
import chooseImage from "./chooseImage";
// API
(uni.$uniQuery as {
[key: string]: any
}) = {
getSystemInfo,
getLocation,
saveAlbum,
chooseImage
};
// 参数
(uni as any)._uniQuery = {};
// 方法
let methods = {
uniQueryAPI(apiName: string, ...params: Array<any>) {
return (uni as any).$uniQuery[apiName](...params);
}
};
export default {
install(Vue: any, options = {}) {
if (Vue.prototype) {
for (let key in methods) {
Vue.prototype[key] = (methods as any)[key];
}
} else {
Vue.mixin({
methods
});
}
(uni as any)._uniQuery.validate = (options as any).validate || {};
}
};