UNPKG

@slan-health/taro-vueuse

Version:

taro vue版本hooks

24 lines (23 loc) 567 B
import Taro from "@tarojs/taro"; function usePromise(options, Instance) { return new Promise((resolve, reject) => { try { if (typeof Instance === "string" && Taro[Instance]) { const methodInstance = Taro[Instance]; methodInstance({ ...options || {}, success: resolve, fail: reject, complete: console.log }); } console.warn("please input a valid method name"); } catch (e) { reject(e); } }); } export { usePromise as default }; //# sourceMappingURL=index.js.map