mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-09-02 01:09:45 +08:00
style-格式化代码
This commit is contained in:
parent
ff12419ce5
commit
8ff3ca01a0
@ -14,16 +14,9 @@
|
||||
},
|
||||
});
|
||||
|
||||
const iconSize = ref<string | boolean>(
|
||||
props.size ? `${props.size}rpx` : false,
|
||||
);
|
||||
const iconSize = ref<string | boolean>(props.size ? `${props.size}rpx` : false);
|
||||
const style = computed(() => {
|
||||
return assign(
|
||||
unref(iconSize)
|
||||
? { width: unref(iconSize), height: unref(iconSize) }
|
||||
: {},
|
||||
props.color ? { color: props.color } : {},
|
||||
);
|
||||
return assign(unref(iconSize) ? { width: unref(iconSize), height: unref(iconSize) } : {}, props.color ? { color: props.color } : {});
|
||||
});
|
||||
|
||||
const emit = defineEmits(['click']);
|
||||
@ -32,12 +25,7 @@
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<view
|
||||
ref="elRef"
|
||||
@click="onClick"
|
||||
:class="['iconify', icon]"
|
||||
:style="style"
|
||||
></view>
|
||||
<view ref="elRef" @click="onClick" :class="['iconify', icon]" :style="style"></view>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.iconify {
|
||||
|
@ -11,11 +11,7 @@
|
||||
import Iconify from '@/components/Iconify/index.vue';
|
||||
import { HOME_PAGE } from '@/enums/routerEnum';
|
||||
|
||||
const {
|
||||
navigationBarBackgroundColor,
|
||||
navigationBarTitleText,
|
||||
navigationBarTextStyle,
|
||||
} = useGlobalStyle();
|
||||
const { navigationBarBackgroundColor, navigationBarTitleText, navigationBarTextStyle } = useGlobalStyle();
|
||||
|
||||
const { currentRoute, currentPages } = useRoute();
|
||||
|
||||
@ -36,28 +32,12 @@
|
||||
const defaultNavbarHeight = ref(44);
|
||||
const defaultTitleSize = ref(16);
|
||||
const defaultIconSize = ref(24);
|
||||
const navbarHeight = computed(
|
||||
() => `${px2rpx(defaultNavbarHeight.value)}rpx`,
|
||||
);
|
||||
const headHeight = computed(
|
||||
() => `${px2rpx((statusBarHeight || 0) + defaultNavbarHeight.value)}rpx`,
|
||||
);
|
||||
const navbarHeight = computed(() => `${px2rpx(defaultNavbarHeight.value)}rpx`);
|
||||
const headHeight = computed(() => `${px2rpx((statusBarHeight || 0) + defaultNavbarHeight.value)}rpx`);
|
||||
const sideGap = computed(() => `${px2rpx(props.gap)}rpx`);
|
||||
const navbarBgColor = computed(
|
||||
() => props.bgColor || navigationBarBackgroundColor,
|
||||
);
|
||||
const navbarTitle = computed(
|
||||
() =>
|
||||
props.title ||
|
||||
currentRoute?.style?.navigationBarTitleText ||
|
||||
navigationBarTitleText,
|
||||
);
|
||||
const navbarTitleColor = computed(
|
||||
() =>
|
||||
props.titleColor ||
|
||||
currentRoute?.style?.navigationBarTextStyle ||
|
||||
navigationBarTextStyle,
|
||||
);
|
||||
const navbarBgColor = computed(() => props.bgColor || navigationBarBackgroundColor);
|
||||
const navbarTitle = computed(() => props.title || currentRoute?.style?.navigationBarTitleText || navigationBarTitleText);
|
||||
const navbarTitleColor = computed(() => props.titleColor || currentRoute?.style?.navigationBarTextStyle || navigationBarTextStyle);
|
||||
const navbarTitleSize = computed(() => {
|
||||
return `${px2rpx(defaultTitleSize.value) || props.titleSize}rpx`;
|
||||
});
|
||||
@ -85,49 +65,25 @@
|
||||
<!-- 顶部状态栏 -->
|
||||
<view class="status-bar"></view>
|
||||
<!-- navbar -->
|
||||
<view
|
||||
:class="[
|
||||
'navbar-wrapper',
|
||||
'_u_flex',
|
||||
'_u_flex-nowrap',
|
||||
'_u_justify-between',
|
||||
'_u_items-center',
|
||||
]"
|
||||
>
|
||||
<view
|
||||
class="_u_flex _u_flex-nowrap _u_items-center _u_h-full _u_w3/10 _u_min-w3/10"
|
||||
>
|
||||
<view :class="['navbar-wrapper', '_u_flex', '_u_flex-nowrap', '_u_justify-between', '_u_items-center']">
|
||||
<view class="_u_flex _u_flex-nowrap _u_items-center _u_h-full _u_w3/10 _u_min-w3/10">
|
||||
<slot name="left">
|
||||
<view class="_u_h-full _u_flex _u_items-center">
|
||||
<template v-if="backShow">
|
||||
<Iconify
|
||||
@click="onBack"
|
||||
:size="navbarLeftIconSize"
|
||||
:color="navbarTitleColor"
|
||||
icon="i-humbleicons-chevron-left"
|
||||
/>
|
||||
<Iconify @click="onBack" :size="navbarLeftIconSize" :color="navbarTitleColor" icon="i-humbleicons-chevron-left" />
|
||||
</template>
|
||||
<template v-if="backHomeShow">
|
||||
<Iconify
|
||||
@click="onBackHome"
|
||||
:size="navbarLeftIconSize"
|
||||
:color="navbarTitleColor"
|
||||
icon="i-iconoir-home-simple-door"
|
||||
/>
|
||||
<Iconify @click="onBackHome" :size="navbarLeftIconSize" :color="navbarTitleColor" icon="i-iconoir-home-simple-door" />
|
||||
</template>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view
|
||||
class="navbar__center _u_flex _u_flex-nowrap _u_justify-center _u_items-center _u_h-full _u_w2/5 _u_min-w2/5"
|
||||
>
|
||||
<view class="navbar__center _u_flex _u_flex-nowrap _u_justify-center _u_items-center _u_h-full _u_w2/5 _u_min-w2/5">
|
||||
<slot>
|
||||
<text>{{ navbarTitle }}</text>
|
||||
</slot>
|
||||
</view>
|
||||
<view
|
||||
class="_u_flex _u_flex-nowrap _u_justify-end _u_items-center _u_h-full _u_w3/10 _u_min-w3/10"
|
||||
>
|
||||
<view class="_u_flex _u_flex-nowrap _u_justify-end _u_items-center _u_h-full _u_w3/10 _u_min-w3/10">
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -6,12 +6,7 @@ export enum NAVIGATE_TYPE {
|
||||
NAVIGATE_BACK = 'navigateBack',
|
||||
}
|
||||
|
||||
export const NAVIGATE_TYPE_LIST = [
|
||||
'navigateTo',
|
||||
'redirectTo',
|
||||
'reLaunch',
|
||||
'switchTab',
|
||||
];
|
||||
export const NAVIGATE_TYPE_LIST = ['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'];
|
||||
|
||||
export const HOME_PAGE = '/pages/index/index';
|
||||
export const LOGIN_PAGE = '/pages/login/index';
|
||||
|
@ -5,12 +5,7 @@ const { globalStyle } = pagesJson;
|
||||
* 全局样式
|
||||
*/
|
||||
export const useGlobalStyle = () => {
|
||||
const {
|
||||
navigationBarTextStyle,
|
||||
navigationBarTitleText,
|
||||
navigationBarBackgroundColor,
|
||||
backgroundColor,
|
||||
} = globalStyle;
|
||||
const { navigationBarTextStyle, navigationBarTitleText, navigationBarBackgroundColor, backgroundColor } = globalStyle;
|
||||
return {
|
||||
navigationBarTextStyle,
|
||||
navigationBarTitleText,
|
||||
|
@ -78,20 +78,8 @@ export const useSystem = () => {
|
||||
cacheLocation,
|
||||
storage,
|
||||
} = uni.getSystemInfoSync();
|
||||
const {
|
||||
top: safeAreaTop,
|
||||
bottom: safeAreaBottom,
|
||||
left: safeAreaLeft,
|
||||
right: safeAreaRight,
|
||||
height: safeAreaHeight,
|
||||
width: safeAreaWidth,
|
||||
} = safeArea!;
|
||||
const {
|
||||
top: safeAreaInsetsTop,
|
||||
bottom: safeAreaInsetsBottom,
|
||||
left: safeAreaInsetsLeft,
|
||||
right: safeAreaInsetsRight,
|
||||
} = safeAreaInsets!;
|
||||
const { top: safeAreaTop, bottom: safeAreaBottom, left: safeAreaLeft, right: safeAreaRight, height: safeAreaHeight, width: safeAreaWidth } = safeArea!;
|
||||
const { top: safeAreaInsetsTop, bottom: safeAreaInsetsBottom, left: safeAreaInsetsLeft, right: safeAreaInsetsRight } = safeAreaInsets!;
|
||||
return {
|
||||
deviceId,
|
||||
deviceBrand,
|
||||
|
@ -33,18 +33,10 @@
|
||||
</view>
|
||||
<view class="desc">{{ isLogin ? '测试' : '未登入' }}</view>
|
||||
</view>
|
||||
<view class="cell"
|
||||
><BasicButton @click="handleJump('/pages/log/index?id=4345&title=log')"
|
||||
>log</BasicButton
|
||||
></view
|
||||
>
|
||||
<view class="cell" v-if="isLogin"
|
||||
><BasicButton @click="handleLoginOut">登出</BasicButton></view
|
||||
>
|
||||
<view class="cell"><BasicButton @click="handleJump('/pages/log/index?id=4345&title=log')">log</BasicButton></view>
|
||||
<view class="cell" v-if="isLogin"><BasicButton @click="handleLoginOut">登出</BasicButton></view>
|
||||
<view class="cell" v-else>
|
||||
<BasicButton @click="handleJump('/pages/login/index')">
|
||||
登入
|
||||
</BasicButton>
|
||||
<BasicButton @click="handleJump('/pages/login/index')"> 登入 </BasicButton>
|
||||
</view>
|
||||
</view>
|
||||
</AppProvider>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
onLoad(query => {
|
||||
onLoad((query) => {
|
||||
console.log('log onLoad', query);
|
||||
});
|
||||
</script>
|
||||
|
@ -6,10 +6,8 @@
|
||||
import { useRouter } from '@/hooks/router';
|
||||
|
||||
const redirect = ref<string | undefined>(undefined);
|
||||
onLoad(query => {
|
||||
redirect.value = query.redirect
|
||||
? decodeURIComponent(query.redirect)
|
||||
: undefined;
|
||||
onLoad((query) => {
|
||||
redirect.value = query.redirect ? decodeURIComponent(query.redirect) : undefined;
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
@ -40,19 +38,13 @@
|
||||
<form class="form" @submit="submit">
|
||||
<label class="form-item">
|
||||
<view class="form-label">邮箱:</view>
|
||||
<view class="form-element"
|
||||
><input name="email" :value="form.email"
|
||||
/></view>
|
||||
<view class="form-element"><input name="email" :value="form.email" /></view>
|
||||
</label>
|
||||
<label class="form-item">
|
||||
<view class="form-label">密码:</view>
|
||||
<view class="form-element"
|
||||
><input type="password" name="password" :value="form.password"
|
||||
/></view>
|
||||
<view class="form-element"><input type="password" name="password" :value="form.password" /></view>
|
||||
</label>
|
||||
<button form-type="submit" class="submit-btn" hover-class="none"
|
||||
>登录</button
|
||||
>
|
||||
<button form-type="submit" class="submit-btn" hover-class="none">登录</button>
|
||||
</form>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -7,7 +7,7 @@
|
||||
const go = ref<string>('');
|
||||
const router = useRouter();
|
||||
const redirect = ref<string>('');
|
||||
onLoad(query => {
|
||||
onLoad((query) => {
|
||||
go.value = query.go || '';
|
||||
redirect.value = query.redirect || '';
|
||||
});
|
||||
|
@ -9,8 +9,6 @@
|
||||
</script>
|
||||
<template>
|
||||
<view class="_u_center"> Test1 </view>
|
||||
<view class="_u_center"
|
||||
><BasicButton @click="jumpTest2">Test2 → </BasicButton></view
|
||||
>
|
||||
<view class="_u_center"><BasicButton @click="jumpTest2">Test2 → </BasicButton></view>
|
||||
</template>
|
||||
<style scoped></style>
|
||||
|
@ -2,10 +2,7 @@ import { getEnvValue, getPkgVersion, isDevMode } from '@/utils/env';
|
||||
|
||||
// System default cache time, in seconds
|
||||
export const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7;
|
||||
const PREFIX =
|
||||
getEnvValue<string>('VITE_APP_CACHE_PREFIX') ||
|
||||
getEnvValue<string>('VITE_APP_TITLE') ||
|
||||
'UNI_APP_VUE3_TS';
|
||||
const PREFIX = getEnvValue<string>('VITE_APP_CACHE_PREFIX') || getEnvValue<string>('VITE_APP_TITLE') || 'UNI_APP_VUE3_TS';
|
||||
export const DEFAULT_PREFIX_KEY = `${PREFIX}${getPkgVersion()}`;
|
||||
|
||||
// aes encryption key
|
||||
|
@ -13,7 +13,7 @@ export const useAuthStore = defineStore({
|
||||
token: undefined,
|
||||
}),
|
||||
getters: {
|
||||
getToken: state => state.token,
|
||||
getToken: (state) => state.token,
|
||||
isLogin: (state): boolean => !!state.token,
|
||||
},
|
||||
actions: {
|
||||
|
2
src/types/router/route.d.ts
vendored
2
src/types/router/route.d.ts
vendored
@ -22,7 +22,7 @@ export interface RouteLocationNormalized {
|
||||
/* 当前页面栈的实例 */
|
||||
currentPages: Page.PageInstance<AnyObject, {}>[];
|
||||
/* 当前页面的实例 */
|
||||
currentPage: Page.PageInstance;
|
||||
currentPage: Page.PageInstance | undefined;
|
||||
/* 当前页面在pages.json中的配置 */
|
||||
currentRoute?: Route;
|
||||
/* 当前页面的path */
|
||||
|
13
src/utils/cache/index.ts
vendored
13
src/utils/cache/index.ts
vendored
@ -1,10 +1,5 @@
|
||||
import { createStorage, CreateStorageParams } from './storageCache';
|
||||
import {
|
||||
cacheCipher,
|
||||
DEFAULT_CACHE_TIME,
|
||||
DEFAULT_PREFIX_KEY,
|
||||
enableStorageEncryption,
|
||||
} from '@/settings/encryptionSetting';
|
||||
import { cacheCipher, DEFAULT_CACHE_TIME, DEFAULT_PREFIX_KEY, enableStorageEncryption } from '@/settings/encryptionSetting';
|
||||
|
||||
const options: Partial<CreateStorageParams> = {
|
||||
prefixKey: DEFAULT_PREFIX_KEY,
|
||||
@ -16,11 +11,7 @@ const options: Partial<CreateStorageParams> = {
|
||||
|
||||
export const storage = createStorage(options);
|
||||
|
||||
export function setCache(
|
||||
key: string,
|
||||
value: any,
|
||||
expire?: number | null,
|
||||
): void {
|
||||
export function setCache(key: string, value: any, expire?: number | null): void {
|
||||
storage.set(key, value, expire);
|
||||
}
|
||||
|
||||
|
14
src/utils/cache/storageCache.ts
vendored
14
src/utils/cache/storageCache.ts
vendored
@ -15,7 +15,7 @@ export const createStorage = ({
|
||||
timeout = null,
|
||||
hasEncrypt = true,
|
||||
}: Partial<CreateStorageParams> = {}) => {
|
||||
if (hasEncrypt && [key.length, iv.length].some(item => item !== 16)) {
|
||||
if (hasEncrypt && [key.length, iv.length].some((item) => item !== 16)) {
|
||||
throw new Error('When hasEncrypt is true, the key or iv must be 16 bits!');
|
||||
}
|
||||
|
||||
@ -60,13 +60,9 @@ export const createStorage = ({
|
||||
const stringData = JSON.stringify({
|
||||
value,
|
||||
time: Date.now(),
|
||||
expire: !isNullOrUnDef(expire)
|
||||
? new Date().getTime() + expire * 1000
|
||||
: null,
|
||||
expire: !isNullOrUnDef(expire) ? new Date().getTime() + expire * 1000 : null,
|
||||
});
|
||||
const stringifyValue = this.hasEncrypt
|
||||
? this.encryption.encryptByAES(stringData)
|
||||
: stringData;
|
||||
const stringifyValue = this.hasEncrypt ? this.encryption.encryptByAES(stringData) : stringData;
|
||||
uni.setStorageSync(this.getKey(key), stringifyValue);
|
||||
} catch (err) {
|
||||
throw new Error(`setStorageSync error: ${err}`);
|
||||
@ -84,9 +80,7 @@ export const createStorage = ({
|
||||
if (!val) return def;
|
||||
|
||||
try {
|
||||
const decVal = this.hasEncrypt
|
||||
? this.encryption.decryptByAES(val)
|
||||
: val;
|
||||
const decVal = this.hasEncrypt ? this.encryption.decryptByAES(val) : val;
|
||||
const data = JSON.parse(decVal);
|
||||
const { value, expire } = data;
|
||||
if (isNullOrUnDef(expire) || expire < new Date().getTime()) {
|
||||
|
@ -26,7 +26,7 @@ const request = createRequest();
|
||||
* 请求拦截器
|
||||
*/
|
||||
request.interceptors.request.use(
|
||||
options => {
|
||||
(options) => {
|
||||
if (options.custom?.auth) {
|
||||
const authStore = useAuthStore();
|
||||
if (!authStore.isLogin) {
|
||||
@ -40,14 +40,14 @@ request.interceptors.request.use(
|
||||
}
|
||||
return options;
|
||||
},
|
||||
options => Promise.reject(options),
|
||||
(options) => Promise.reject(options)
|
||||
);
|
||||
|
||||
/**
|
||||
* 响应拦截器
|
||||
*/
|
||||
request.interceptors.response.use(
|
||||
async response => {
|
||||
async (response) => {
|
||||
const { data: resData } = response;
|
||||
const { code, message } = resData;
|
||||
if (code === ResultEnum.SUCCESS) {
|
||||
@ -56,10 +56,10 @@ request.interceptors.response.use(
|
||||
Toast(message);
|
||||
return Promise.reject(resData);
|
||||
},
|
||||
response =>
|
||||
(response) =>
|
||||
// 请求错误做点什么。可以使用async await 做异步操作
|
||||
// error('Request Error!');
|
||||
Promise.reject(response),
|
||||
Promise.reject(response)
|
||||
);
|
||||
|
||||
export { request };
|
||||
|
@ -8,9 +8,7 @@ import { isObject } from '@/utils/is';
|
||||
export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
|
||||
let key: string;
|
||||
for (key in target) {
|
||||
src[key] = isObject(src[key])
|
||||
? deepMerge(src[key], target[key])
|
||||
: (src[key] = target[key]);
|
||||
src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]);
|
||||
}
|
||||
return src;
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
import {
|
||||
routerInterceptor,
|
||||
routerRemoveInterceptor,
|
||||
} from '@/utils/router/interceptor';
|
||||
import { routerInterceptor, routerRemoveInterceptor } from '@/utils/router/interceptor';
|
||||
|
||||
export function setupInterceptors() {
|
||||
routerInterceptor();
|
||||
|
@ -53,12 +53,7 @@ export function isNumber(val: unknown): val is number {
|
||||
}
|
||||
|
||||
export function isPromise<T = any>(val: unknown): val is Promise<T> {
|
||||
return (
|
||||
is(val, 'Promise') &&
|
||||
isObject(val) &&
|
||||
isFunction(val.then) &&
|
||||
isFunction(val.catch)
|
||||
);
|
||||
return is(val, 'Promise') && isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
}
|
||||
|
||||
export function isString(val: unknown): val is string {
|
||||
|
@ -1,8 +1,4 @@
|
||||
import {
|
||||
HOME_PAGE,
|
||||
NAVIGATE_TYPE_LIST,
|
||||
NOT_FOUND_PAGE,
|
||||
} from '@/enums/routerEnum';
|
||||
import { HOME_PAGE, NAVIGATE_TYPE_LIST, NOT_FOUND_PAGE } from '@/enums/routerEnum';
|
||||
import { useAuthStore } from '@/state/modules/auth';
|
||||
import { isIgnoreAuth, jumpLogin } from '@/utils/router/constant';
|
||||
|
||||
@ -32,7 +28,7 @@ export function routerBeforeEach(path: string): boolean {
|
||||
function addInterceptor(routerName: string) {
|
||||
uni.addInterceptor(routerName, {
|
||||
// 跳转前拦截
|
||||
invoke: args => {
|
||||
invoke: (args) => {
|
||||
const flag = routerBeforeEach(args.url);
|
||||
return flag ? args : false;
|
||||
},
|
||||
@ -64,7 +60,7 @@ function addInterceptor(routerName: string) {
|
||||
* 添加路由拦截器
|
||||
*/
|
||||
export function routerInterceptor() {
|
||||
NAVIGATE_TYPE_LIST.forEach(item => {
|
||||
NAVIGATE_TYPE_LIST.forEach((item) => {
|
||||
addInterceptor(item);
|
||||
});
|
||||
}
|
||||
@ -73,7 +69,7 @@ export function routerInterceptor() {
|
||||
* 移除路由拦截器
|
||||
*/
|
||||
export function routerRemoveInterceptor() {
|
||||
NAVIGATE_TYPE_LIST.forEach(item => {
|
||||
NAVIGATE_TYPE_LIST.forEach((item) => {
|
||||
uni.removeInterceptor(item);
|
||||
});
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ const { pages, subPackages, tabBar } = pagesJson;
|
||||
// 将pages.json转换成Map对象,path为key
|
||||
const pagesMap = new Map<string, Route>();
|
||||
|
||||
pages.forEach(page => {
|
||||
pages.forEach((page) => {
|
||||
pagesMap.set(page.path, page as Route);
|
||||
});
|
||||
|
||||
if (Array.isArray(subPackages) && subPackages.length) {
|
||||
subPackages.forEach(el => {
|
||||
subPackages.forEach((el) => {
|
||||
const rootPath = el.root;
|
||||
el.pages.forEach(page => {
|
||||
el.pages.forEach((page) => {
|
||||
page.path = `${rootPath}/${page.path}`;
|
||||
pagesMap.set(page.path, page as Route);
|
||||
});
|
||||
@ -24,7 +24,7 @@ if (Array.isArray(subPackages) && subPackages.length) {
|
||||
if (tabBar) {
|
||||
const tabBarList = tabBar.list;
|
||||
if (Array.isArray(tabBarList)) {
|
||||
tabBarList.forEach(el => {
|
||||
tabBarList.forEach((el) => {
|
||||
if (pagesMap.has(el.pagePath)) {
|
||||
const page = pagesMap.get(el.pagePath);
|
||||
const meta = page?.meta || {};
|
||||
|
@ -9,10 +9,10 @@ export const SetClipboardData = (data: string, showToast = true) =>
|
||||
uni.setClipboardData({
|
||||
data,
|
||||
showToast,
|
||||
success: res => {
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: err => {
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
@ -25,10 +25,10 @@ export const SetClipboardData = (data: string, showToast = true) =>
|
||||
export const GetClipboardData = () =>
|
||||
new Promise((resolve, reject) => {
|
||||
uni.getClipboardData({
|
||||
success: res => {
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: err => {
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
|
@ -9,10 +9,7 @@
|
||||
* @param options
|
||||
* @constructor
|
||||
*/
|
||||
export function Toast(
|
||||
title: string,
|
||||
options?: Partial<UniApp.ShowToastOptions>,
|
||||
) {
|
||||
export function Toast(title: string, options?: Partial<UniApp.ShowToastOptions>) {
|
||||
uni.showToast({
|
||||
title,
|
||||
duration: 1500,
|
||||
@ -35,10 +32,7 @@ export function HideToast() {
|
||||
* @param options
|
||||
* @constructor
|
||||
*/
|
||||
export function Loading(
|
||||
title: string,
|
||||
options?: Partial<UniApp.ShowLoadingOptions>,
|
||||
) {
|
||||
export function Loading(title: string, options?: Partial<UniApp.ShowLoadingOptions>) {
|
||||
uni.showLoading({
|
||||
title,
|
||||
mask: true,
|
||||
@ -62,10 +56,10 @@ export function Modal(options: UniApp.ShowModalOptions) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showModal({
|
||||
...options,
|
||||
success: res => {
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: res => {
|
||||
fail: (res) => {
|
||||
reject(res);
|
||||
},
|
||||
});
|
||||
@ -81,10 +75,10 @@ export function ActionSheet(options: UniApp.ShowActionSheetOptions) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showActionSheet({
|
||||
...options,
|
||||
success: res => {
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: res => {
|
||||
fail: (res) => {
|
||||
reject(res);
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user