style-格式化代码

This commit is contained in:
Huang 2023-02-20 15:14:14 +08:00
parent ff12419ce5
commit 8ff3ca01a0
55 changed files with 1535 additions and 1669 deletions

View File

@ -14,16 +14,9 @@
}, },
}); });
const iconSize = ref<string | boolean>( const iconSize = ref<string | boolean>(props.size ? `${props.size}rpx` : false);
props.size ? `${props.size}rpx` : false,
);
const style = computed(() => { const style = computed(() => {
return assign( return assign(unref(iconSize) ? { width: unref(iconSize), height: unref(iconSize) } : {}, props.color ? { color: props.color } : {});
unref(iconSize)
? { width: unref(iconSize), height: unref(iconSize) }
: {},
props.color ? { color: props.color } : {},
);
}); });
const emit = defineEmits(['click']); const emit = defineEmits(['click']);
@ -32,12 +25,7 @@
}; };
</script> </script>
<template> <template>
<view <view ref="elRef" @click="onClick" :class="['iconify', icon]" :style="style"></view>
ref="elRef"
@click="onClick"
:class="['iconify', icon]"
:style="style"
></view>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.iconify { .iconify {

View File

@ -11,11 +11,7 @@
import Iconify from '@/components/Iconify/index.vue'; import Iconify from '@/components/Iconify/index.vue';
import { HOME_PAGE } from '@/enums/routerEnum'; import { HOME_PAGE } from '@/enums/routerEnum';
const { const { navigationBarBackgroundColor, navigationBarTitleText, navigationBarTextStyle } = useGlobalStyle();
navigationBarBackgroundColor,
navigationBarTitleText,
navigationBarTextStyle,
} = useGlobalStyle();
const { currentRoute, currentPages } = useRoute(); const { currentRoute, currentPages } = useRoute();
@ -36,28 +32,12 @@
const defaultNavbarHeight = ref(44); const defaultNavbarHeight = ref(44);
const defaultTitleSize = ref(16); const defaultTitleSize = ref(16);
const defaultIconSize = ref(24); const defaultIconSize = ref(24);
const navbarHeight = computed( const navbarHeight = computed(() => `${px2rpx(defaultNavbarHeight.value)}rpx`);
() => `${px2rpx(defaultNavbarHeight.value)}rpx`, const headHeight = computed(() => `${px2rpx((statusBarHeight || 0) + defaultNavbarHeight.value)}rpx`);
);
const headHeight = computed(
() => `${px2rpx((statusBarHeight || 0) + defaultNavbarHeight.value)}rpx`,
);
const sideGap = computed(() => `${px2rpx(props.gap)}rpx`); const sideGap = computed(() => `${px2rpx(props.gap)}rpx`);
const navbarBgColor = computed( const navbarBgColor = computed(() => props.bgColor || navigationBarBackgroundColor);
() => props.bgColor || navigationBarBackgroundColor, const navbarTitle = computed(() => props.title || currentRoute?.style?.navigationBarTitleText || navigationBarTitleText);
); const navbarTitleColor = computed(() => props.titleColor || currentRoute?.style?.navigationBarTextStyle || navigationBarTextStyle);
const navbarTitle = computed(
() =>
props.title ||
currentRoute?.style?.navigationBarTitleText ||
navigationBarTitleText,
);
const navbarTitleColor = computed(
() =>
props.titleColor ||
currentRoute?.style?.navigationBarTextStyle ||
navigationBarTextStyle,
);
const navbarTitleSize = computed(() => { const navbarTitleSize = computed(() => {
return `${px2rpx(defaultTitleSize.value) || props.titleSize}rpx`; return `${px2rpx(defaultTitleSize.value) || props.titleSize}rpx`;
}); });
@ -85,49 +65,25 @@
<!-- 顶部状态栏 --> <!-- 顶部状态栏 -->
<view class="status-bar"></view> <view class="status-bar"></view>
<!-- navbar --> <!-- navbar -->
<view <view :class="['navbar-wrapper', '_u_flex', '_u_flex-nowrap', '_u_justify-between', '_u_items-center']">
:class="[ <view class="_u_flex _u_flex-nowrap _u_items-center _u_h-full _u_w3/10 _u_min-w3/10">
'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"> <slot name="left">
<view class="_u_h-full _u_flex _u_items-center"> <view class="_u_h-full _u_flex _u_items-center">
<template v-if="backShow"> <template v-if="backShow">
<Iconify <Iconify @click="onBack" :size="navbarLeftIconSize" :color="navbarTitleColor" icon="i-humbleicons-chevron-left" />
@click="onBack"
:size="navbarLeftIconSize"
:color="navbarTitleColor"
icon="i-humbleicons-chevron-left"
/>
</template> </template>
<template v-if="backHomeShow"> <template v-if="backHomeShow">
<Iconify <Iconify @click="onBackHome" :size="navbarLeftIconSize" :color="navbarTitleColor" icon="i-iconoir-home-simple-door" />
@click="onBackHome"
:size="navbarLeftIconSize"
:color="navbarTitleColor"
icon="i-iconoir-home-simple-door"
/>
</template> </template>
</view> </view>
</slot> </slot>
</view> </view>
<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">
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> <slot>
<text>{{ navbarTitle }}</text> <text>{{ navbarTitle }}</text>
</slot> </slot>
</view> </view>
<view <view class="_u_flex _u_flex-nowrap _u_justify-end _u_items-center _u_h-full _u_w3/10 _u_min-w3/10">
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> <slot name="right"></slot>
</view> </view>
</view> </view>

View File

@ -6,12 +6,7 @@ export enum NAVIGATE_TYPE {
NAVIGATE_BACK = 'navigateBack', NAVIGATE_BACK = 'navigateBack',
} }
export const NAVIGATE_TYPE_LIST = [ export const NAVIGATE_TYPE_LIST = ['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'];
'navigateTo',
'redirectTo',
'reLaunch',
'switchTab',
];
export const HOME_PAGE = '/pages/index/index'; export const HOME_PAGE = '/pages/index/index';
export const LOGIN_PAGE = '/pages/login/index'; export const LOGIN_PAGE = '/pages/login/index';

View File

@ -5,12 +5,7 @@ const { globalStyle } = pagesJson;
* *
*/ */
export const useGlobalStyle = () => { export const useGlobalStyle = () => {
const { const { navigationBarTextStyle, navigationBarTitleText, navigationBarBackgroundColor, backgroundColor } = globalStyle;
navigationBarTextStyle,
navigationBarTitleText,
navigationBarBackgroundColor,
backgroundColor,
} = globalStyle;
return { return {
navigationBarTextStyle, navigationBarTextStyle,
navigationBarTitleText, navigationBarTitleText,

View File

@ -78,20 +78,8 @@ export const useSystem = () => {
cacheLocation, cacheLocation,
storage, storage,
} = uni.getSystemInfoSync(); } = uni.getSystemInfoSync();
const { const { top: safeAreaTop, bottom: safeAreaBottom, left: safeAreaLeft, right: safeAreaRight, height: safeAreaHeight, width: safeAreaWidth } = safeArea!;
top: safeAreaTop, const { top: safeAreaInsetsTop, bottom: safeAreaInsetsBottom, left: safeAreaInsetsLeft, right: safeAreaInsetsRight } = safeAreaInsets!;
bottom: safeAreaBottom,
left: safeAreaLeft,
right: safeAreaRight,
height: safeAreaHeight,
width: safeAreaWidth,
} = safeArea!;
const {
top: safeAreaInsetsTop,
bottom: safeAreaInsetsBottom,
left: safeAreaInsetsLeft,
right: safeAreaInsetsRight,
} = safeAreaInsets!;
return { return {
deviceId, deviceId,
deviceBrand, deviceBrand,

View File

@ -33,18 +33,10 @@
</view> </view>
<view class="desc">{{ isLogin ? '测试' : '未登入' }}</view> <view class="desc">{{ isLogin ? '测试' : '未登入' }}</view>
</view> </view>
<view class="cell" <view class="cell"><BasicButton @click="handleJump('/pages/log/index?id=4345&title=log')">log</BasicButton></view>
><BasicButton @click="handleJump('/pages/log/index?id=4345&title=log')" <view class="cell" v-if="isLogin"><BasicButton @click="handleLoginOut">登出</BasicButton></view>
>log</BasicButton
></view
>
<view class="cell" v-if="isLogin"
><BasicButton @click="handleLoginOut">登出</BasicButton></view
>
<view class="cell" v-else> <view class="cell" v-else>
<BasicButton @click="handleJump('/pages/login/index')"> <BasicButton @click="handleJump('/pages/login/index')"> 登入 </BasicButton>
登入
</BasicButton>
</view> </view>
</view> </view>
</AppProvider> </AppProvider>

View File

@ -5,7 +5,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
onLoad(query => { onLoad((query) => {
console.log('log onLoad', query); console.log('log onLoad', query);
}); });
</script> </script>

View File

@ -6,10 +6,8 @@
import { useRouter } from '@/hooks/router'; import { useRouter } from '@/hooks/router';
const redirect = ref<string | undefined>(undefined); const redirect = ref<string | undefined>(undefined);
onLoad(query => { onLoad((query) => {
redirect.value = query.redirect redirect.value = query.redirect ? decodeURIComponent(query.redirect) : undefined;
? decodeURIComponent(query.redirect)
: undefined;
}); });
const router = useRouter(); const router = useRouter();
@ -40,19 +38,13 @@
<form class="form" @submit="submit"> <form class="form" @submit="submit">
<label class="form-item"> <label class="form-item">
<view class="form-label">邮箱:</view> <view class="form-label">邮箱:</view>
<view class="form-element" <view class="form-element"><input name="email" :value="form.email" /></view>
><input name="email" :value="form.email"
/></view>
</label> </label>
<label class="form-item"> <label class="form-item">
<view class="form-label">密码:</view> <view class="form-label">密码:</view>
<view class="form-element" <view class="form-element"><input type="password" name="password" :value="form.password" /></view>
><input type="password" name="password" :value="form.password"
/></view>
</label> </label>
<button form-type="submit" class="submit-btn" hover-class="none" <button form-type="submit" class="submit-btn" hover-class="none">登录</button>
>登录</button
>
</form> </form>
</view> </view>
</view> </view>

View File

@ -7,7 +7,7 @@
const go = ref<string>(''); const go = ref<string>('');
const router = useRouter(); const router = useRouter();
const redirect = ref<string>(''); const redirect = ref<string>('');
onLoad(query => { onLoad((query) => {
go.value = query.go || ''; go.value = query.go || '';
redirect.value = query.redirect || ''; redirect.value = query.redirect || '';
}); });

View File

@ -9,8 +9,6 @@
</script> </script>
<template> <template>
<view class="_u_center"> Test1 </view> <view class="_u_center"> Test1 </view>
<view class="_u_center" <view class="_u_center"><BasicButton @click="jumpTest2">Test2 </BasicButton></view>
><BasicButton @click="jumpTest2">Test2 </BasicButton></view
>
</template> </template>
<style scoped></style> <style scoped></style>

View File

@ -2,10 +2,7 @@ import { getEnvValue, getPkgVersion, isDevMode } from '@/utils/env';
// System default cache time, in seconds // System default cache time, in seconds
export const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7; export const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7;
const PREFIX = const PREFIX = getEnvValue<string>('VITE_APP_CACHE_PREFIX') || getEnvValue<string>('VITE_APP_TITLE') || 'UNI_APP_VUE3_TS';
getEnvValue<string>('VITE_APP_CACHE_PREFIX') ||
getEnvValue<string>('VITE_APP_TITLE') ||
'UNI_APP_VUE3_TS';
export const DEFAULT_PREFIX_KEY = `${PREFIX}${getPkgVersion()}`; export const DEFAULT_PREFIX_KEY = `${PREFIX}${getPkgVersion()}`;
// aes encryption key // aes encryption key

View File

@ -13,7 +13,7 @@ export const useAuthStore = defineStore({
token: undefined, token: undefined,
}), }),
getters: { getters: {
getToken: state => state.token, getToken: (state) => state.token,
isLogin: (state): boolean => !!state.token, isLogin: (state): boolean => !!state.token,
}, },
actions: { actions: {

View File

@ -22,7 +22,7 @@ export interface RouteLocationNormalized {
/* 当前页面栈的实例 */ /* 当前页面栈的实例 */
currentPages: Page.PageInstance<AnyObject, {}>[]; currentPages: Page.PageInstance<AnyObject, {}>[];
/* 当前页面的实例 */ /* 当前页面的实例 */
currentPage: Page.PageInstance; currentPage: Page.PageInstance | undefined;
/* 当前页面在pages.json中的配置 */ /* 当前页面在pages.json中的配置 */
currentRoute?: Route; currentRoute?: Route;
/* 当前页面的path */ /* 当前页面的path */

View File

@ -1,10 +1,5 @@
import { createStorage, CreateStorageParams } from './storageCache'; import { createStorage, CreateStorageParams } from './storageCache';
import { import { cacheCipher, DEFAULT_CACHE_TIME, DEFAULT_PREFIX_KEY, enableStorageEncryption } from '@/settings/encryptionSetting';
cacheCipher,
DEFAULT_CACHE_TIME,
DEFAULT_PREFIX_KEY,
enableStorageEncryption,
} from '@/settings/encryptionSetting';
const options: Partial<CreateStorageParams> = { const options: Partial<CreateStorageParams> = {
prefixKey: DEFAULT_PREFIX_KEY, prefixKey: DEFAULT_PREFIX_KEY,
@ -16,11 +11,7 @@ const options: Partial<CreateStorageParams> = {
export const storage = createStorage(options); export const storage = createStorage(options);
export function setCache( export function setCache(key: string, value: any, expire?: number | null): void {
key: string,
value: any,
expire?: number | null,
): void {
storage.set(key, value, expire); storage.set(key, value, expire);
} }

View File

@ -15,7 +15,7 @@ export const createStorage = ({
timeout = null, timeout = null,
hasEncrypt = true, hasEncrypt = true,
}: Partial<CreateStorageParams> = {}) => { }: 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!'); 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({ const stringData = JSON.stringify({
value, value,
time: Date.now(), time: Date.now(),
expire: !isNullOrUnDef(expire) expire: !isNullOrUnDef(expire) ? new Date().getTime() + expire * 1000 : null,
? new Date().getTime() + expire * 1000
: null,
}); });
const stringifyValue = this.hasEncrypt const stringifyValue = this.hasEncrypt ? this.encryption.encryptByAES(stringData) : stringData;
? this.encryption.encryptByAES(stringData)
: stringData;
uni.setStorageSync(this.getKey(key), stringifyValue); uni.setStorageSync(this.getKey(key), stringifyValue);
} catch (err) { } catch (err) {
throw new Error(`setStorageSync error: ${err}`); throw new Error(`setStorageSync error: ${err}`);
@ -84,9 +80,7 @@ export const createStorage = ({
if (!val) return def; if (!val) return def;
try { try {
const decVal = this.hasEncrypt const decVal = this.hasEncrypt ? this.encryption.decryptByAES(val) : val;
? this.encryption.decryptByAES(val)
: val;
const data = JSON.parse(decVal); const data = JSON.parse(decVal);
const { value, expire } = data; const { value, expire } = data;
if (isNullOrUnDef(expire) || expire < new Date().getTime()) { if (isNullOrUnDef(expire) || expire < new Date().getTime()) {

View File

@ -26,7 +26,7 @@ const request = createRequest();
* *
*/ */
request.interceptors.request.use( request.interceptors.request.use(
options => { (options) => {
if (options.custom?.auth) { if (options.custom?.auth) {
const authStore = useAuthStore(); const authStore = useAuthStore();
if (!authStore.isLogin) { if (!authStore.isLogin) {
@ -40,14 +40,14 @@ request.interceptors.request.use(
} }
return options; return options;
}, },
options => Promise.reject(options), (options) => Promise.reject(options)
); );
/** /**
* *
*/ */
request.interceptors.response.use( request.interceptors.response.use(
async response => { async (response) => {
const { data: resData } = response; const { data: resData } = response;
const { code, message } = resData; const { code, message } = resData;
if (code === ResultEnum.SUCCESS) { if (code === ResultEnum.SUCCESS) {
@ -56,10 +56,10 @@ request.interceptors.response.use(
Toast(message); Toast(message);
return Promise.reject(resData); return Promise.reject(resData);
}, },
response => (response) =>
// 请求错误做点什么。可以使用async await 做异步操作 // 请求错误做点什么。可以使用async await 做异步操作
// error('Request Error!'); // error('Request Error!');
Promise.reject(response), Promise.reject(response)
); );
export { request }; export { request };

View File

@ -8,9 +8,7 @@ import { isObject } from '@/utils/is';
export function deepMerge<T = any>(src: any = {}, target: any = {}): T { export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
let key: string; let key: string;
for (key in target) { for (key in target) {
src[key] = isObject(src[key]) src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]);
? deepMerge(src[key], target[key])
: (src[key] = target[key]);
} }
return src; return src;
} }

View File

@ -1,7 +1,4 @@
import { import { routerInterceptor, routerRemoveInterceptor } from '@/utils/router/interceptor';
routerInterceptor,
routerRemoveInterceptor,
} from '@/utils/router/interceptor';
export function setupInterceptors() { export function setupInterceptors() {
routerInterceptor(); routerInterceptor();

View File

@ -53,12 +53,7 @@ export function isNumber(val: unknown): val is number {
} }
export function isPromise<T = any>(val: unknown): val is Promise<T> { export function isPromise<T = any>(val: unknown): val is Promise<T> {
return ( return is(val, 'Promise') && isObject(val) && isFunction(val.then) && isFunction(val.catch);
is(val, 'Promise') &&
isObject(val) &&
isFunction(val.then) &&
isFunction(val.catch)
);
} }
export function isString(val: unknown): val is string { export function isString(val: unknown): val is string {

View File

@ -1,8 +1,4 @@
import { import { HOME_PAGE, NAVIGATE_TYPE_LIST, NOT_FOUND_PAGE } from '@/enums/routerEnum';
HOME_PAGE,
NAVIGATE_TYPE_LIST,
NOT_FOUND_PAGE,
} from '@/enums/routerEnum';
import { useAuthStore } from '@/state/modules/auth'; import { useAuthStore } from '@/state/modules/auth';
import { isIgnoreAuth, jumpLogin } from '@/utils/router/constant'; import { isIgnoreAuth, jumpLogin } from '@/utils/router/constant';
@ -32,7 +28,7 @@ export function routerBeforeEach(path: string): boolean {
function addInterceptor(routerName: string) { function addInterceptor(routerName: string) {
uni.addInterceptor(routerName, { uni.addInterceptor(routerName, {
// 跳转前拦截 // 跳转前拦截
invoke: args => { invoke: (args) => {
const flag = routerBeforeEach(args.url); const flag = routerBeforeEach(args.url);
return flag ? args : false; return flag ? args : false;
}, },
@ -64,7 +60,7 @@ function addInterceptor(routerName: string) {
* *
*/ */
export function routerInterceptor() { export function routerInterceptor() {
NAVIGATE_TYPE_LIST.forEach(item => { NAVIGATE_TYPE_LIST.forEach((item) => {
addInterceptor(item); addInterceptor(item);
}); });
} }
@ -73,7 +69,7 @@ export function routerInterceptor() {
* *
*/ */
export function routerRemoveInterceptor() { export function routerRemoveInterceptor() {
NAVIGATE_TYPE_LIST.forEach(item => { NAVIGATE_TYPE_LIST.forEach((item) => {
uni.removeInterceptor(item); uni.removeInterceptor(item);
}); });
} }

View File

@ -7,14 +7,14 @@ const { pages, subPackages, tabBar } = pagesJson;
// 将pages.json转换成Map对象,path为key // 将pages.json转换成Map对象,path为key
const pagesMap = new Map<string, Route>(); const pagesMap = new Map<string, Route>();
pages.forEach(page => { pages.forEach((page) => {
pagesMap.set(page.path, page as Route); pagesMap.set(page.path, page as Route);
}); });
if (Array.isArray(subPackages) && subPackages.length) { if (Array.isArray(subPackages) && subPackages.length) {
subPackages.forEach(el => { subPackages.forEach((el) => {
const rootPath = el.root; const rootPath = el.root;
el.pages.forEach(page => { el.pages.forEach((page) => {
page.path = `${rootPath}/${page.path}`; page.path = `${rootPath}/${page.path}`;
pagesMap.set(page.path, page as Route); pagesMap.set(page.path, page as Route);
}); });
@ -24,7 +24,7 @@ if (Array.isArray(subPackages) && subPackages.length) {
if (tabBar) { if (tabBar) {
const tabBarList = tabBar.list; const tabBarList = tabBar.list;
if (Array.isArray(tabBarList)) { if (Array.isArray(tabBarList)) {
tabBarList.forEach(el => { tabBarList.forEach((el) => {
if (pagesMap.has(el.pagePath)) { if (pagesMap.has(el.pagePath)) {
const page = pagesMap.get(el.pagePath); const page = pagesMap.get(el.pagePath);
const meta = page?.meta || {}; const meta = page?.meta || {};

View File

@ -9,10 +9,10 @@ export const SetClipboardData = (data: string, showToast = true) =>
uni.setClipboardData({ uni.setClipboardData({
data, data,
showToast, showToast,
success: res => { success: (res) => {
resolve(res); resolve(res);
}, },
fail: err => { fail: (err) => {
reject(err); reject(err);
}, },
}); });
@ -25,10 +25,10 @@ export const SetClipboardData = (data: string, showToast = true) =>
export const GetClipboardData = () => export const GetClipboardData = () =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
uni.getClipboardData({ uni.getClipboardData({
success: res => { success: (res) => {
resolve(res); resolve(res);
}, },
fail: err => { fail: (err) => {
reject(err); reject(err);
}, },
}); });

View File

@ -9,10 +9,7 @@
* @param options * @param options
* @constructor * @constructor
*/ */
export function Toast( export function Toast(title: string, options?: Partial<UniApp.ShowToastOptions>) {
title: string,
options?: Partial<UniApp.ShowToastOptions>,
) {
uni.showToast({ uni.showToast({
title, title,
duration: 1500, duration: 1500,
@ -35,10 +32,7 @@ export function HideToast() {
* @param options * @param options
* @constructor * @constructor
*/ */
export function Loading( export function Loading(title: string, options?: Partial<UniApp.ShowLoadingOptions>) {
title: string,
options?: Partial<UniApp.ShowLoadingOptions>,
) {
uni.showLoading({ uni.showLoading({
title, title,
mask: true, mask: true,
@ -62,10 +56,10 @@ export function Modal(options: UniApp.ShowModalOptions) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.showModal({ uni.showModal({
...options, ...options,
success: res => { success: (res) => {
resolve(res); resolve(res);
}, },
fail: res => { fail: (res) => {
reject(res); reject(res);
}, },
}); });
@ -81,10 +75,10 @@ export function ActionSheet(options: UniApp.ShowActionSheetOptions) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.showActionSheet({ uni.showActionSheet({
...options, ...options,
success: res => { success: (res) => {
resolve(res); resolve(res);
}, },
fail: res => { fail: (res) => {
reject(res); reject(res);
}, },
}); });