@slan-health/taro-vueuse
Version:
taro vue版本hooks
24 lines (22 loc) • 1.02 kB
TypeScript
import { AuthSetting, SubscriptionsSetting } from '@tarojs/taro';
export interface DeviceAuthOption {
/** 必填,权限名称,名称查看文档https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html */
scope: keyof AuthSetting;
/** 未授权的提示语 */
modalTitle?: string;
/** 确定按钮的文案 */
confirmText?: string;
}
interface GetSettingSuccessCallbackResult extends TaroGeneral.CallbackResult {
/** 用户授权结果 */
authSetting: AuthSetting;
/** 用户订阅消息设置,接口参数 withSubscriptions 值为 true 时才会返回。 */
subscriptionsSetting: SubscriptionsSetting;
/** 在插件中调用时,当前宿主小程序的用户授权结果 */
miniprogramAuthSetting: AuthSetting;
/** 调用结果 */
errMsg: string;
}
export type RequestDeviceAuth = (options: DeviceAuthOption) => Promise<GetSettingSuccessCallbackResult>;
export default function useDeviceAuth(): RequestDeviceAuth[];
export {};