123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import Vue from "vue";
- // 查找元素信息
- Vue.prototype.$createQuery = (query, arg) => {
- return new Promise((resolve) => {
- if (arg) {
- uni
- .createSelectorQuery()
- .in(arg)
- .select(`${query}`)
- .boundingClientRect((res) => {
- resolve(res);
- }).exec();
- } else {
- uni
- .createSelectorQuery()
- .select(`${query}`)
- .boundingClientRect((res) => {
- resolve(res);
- }).exec();
- }
- });
- };
- // toast提示
- Vue.prototype.$showToast = (params) => {
- uni.showToast({
- title: params.title,
- mask: params.mask === false ? false : true,
- icon: params.icon || 'none',
- duration: params.duration || 2000
- })
- }
- // loading加载
- Vue.prototype.$showLoading = (params) => {
- uni.showLoading({
- mask: (params && params.mask === false) ? false : true
- })
- }
- // 获取存储-getStorageSync
- Vue.prototype.$getSS = (name) => {
- return uni.getStorageSync(name)
- }
- // 设置存储-getStorageSync
- Vue.prototype.$setSS = (name, value) => {
- uni.setStorageSync(name, value)
- }
|