diff --git a/packages/taro-cli/templates/default/_env.example b/packages/taro-cli/templates/default/_env.example new file mode 100644 index 000000000000..e5da8984317d --- /dev/null +++ b/packages/taro-cli/templates/default/_env.example @@ -0,0 +1,3 @@ +# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config +# 复制本文件到 .env.development / .env.production / .env.test 后按环境填写 +TARO_APP_ID="请替换为你的小程序 AppID" diff --git a/packages/taro-cli/templates/default/_gitignore b/packages/taro-cli/templates/default/_gitignore index bc6455742b01..c5212722423e 100644 --- a/packages/taro-cli/templates/default/_gitignore +++ b/packages/taro-cli/templates/default/_gitignore @@ -6,3 +6,5 @@ node_modules/ .DS_Store .swc *.local +.env* +!.env.example diff --git a/packages/taro-cli/templates/default/template_creator.js b/packages/taro-cli/templates/default/template_creator.js index 8655df42bdb3..c08fef6c0673 100644 --- a/packages/taro-cli/templates/default/template_creator.js +++ b/packages/taro-cli/templates/default/template_creator.js @@ -56,6 +56,9 @@ const handler = { '/_env.test' () { return { setPageName: `/.env.test` } }, + '/_env.example' () { + return { setPageName: `/.env.example` } + }, '/_eslintrc' () { return { setPageName: `/.eslintrc` } }, diff --git a/packages/taro/types/api/storage/index.d.ts b/packages/taro/types/api/storage/index.d.ts index e1d8084f0b83..389dcd953a12 100644 --- a/packages/taro/types/api/storage/index.d.ts +++ b/packages/taro/types/api/storage/index.d.ts @@ -20,11 +20,20 @@ declare module '../../index' { /** 本地缓存中指定的 key */ key: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: (res: TaroGeneral.CallbackResult) => void + complete?: (res: SuccessCallbackResult) => void /** 接口调用失败的回调函数 */ fail?: (res: TaroGeneral.CallbackResult) => void /** 接口调用成功的回调函数 */ - success?: (res: TaroGeneral.CallbackResult) => void + success?: (res: SuccessCallbackResult) => void + } + + interface SuccessCallbackResult extends Omit { + /** 调用结果 */ + errMsg?: string + /** 是否执行成功 + * @supported alipay + */ + success?: boolean } } @@ -192,7 +201,7 @@ declare module '../../index' { * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html */ - setStorage(option: setStorage.Option): Promise + setStorage(option: setStorage.Option): Promise /** 根据 URL 销毁存在内存中的数据 * @supported weapp