From af5e08e52e88996ca22e4215a5788bb22ba72e48 Mon Sep 17 00:00:00 2001 From: MeetinaXD Date: Mon, 26 Aug 2024 23:03:32 +0800 Subject: [PATCH 1/7] fix: update the usage of state update in middleware --- .../07-project/01-best-practice/05-middleware.md | 10 ++++++---- .../07-project/01-best-practice/05-middleware.md | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/tutorial/07-project/01-best-practice/05-middleware.md b/docs/tutorial/07-project/01-best-practice/05-middleware.md index 67afb2eb35..1071a62246 100644 --- a/docs/tutorial/07-project/01-best-practice/05-middleware.md +++ b/docs/tutorial/07-project/01-best-practice/05-middleware.md @@ -10,15 +10,17 @@ When the response is very fast, the loading status will flash once, which will b const delayLoadingMiddleware = (delayTimer = 1000) => async (ctx, next) => { - //Control loading by yourself + const { loading } = ctx.proxyStates; + + // Control loading by yourself ctx.controlLoading(); - //Delay updates for a specific time + // Delay updates for a specific time const timer = setTimeout(() => { - ctx.update({ loading: true }); + loading.v = true; }, delayTimer); await next(); - ctx.update({ loading: false }); + loading.v = false; clearTimeout(timer); }; diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/05-middleware.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/05-middleware.md index d2242dc8ca..b864e8cb28 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/05-middleware.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/05-middleware.md @@ -10,15 +10,17 @@ title: 常用中间件实践 const delayLoadingMiddleware = (delayTimer = 1000) => async (ctx, next) => { + const { loading } = ctx.proxyStates; + // 自行控制loading ctx.controlLoading(); // 延迟特定时间更新 const timer = setTimeout(() => { - ctx.update({ loading: true }); + loading.v = true; }, delayTimer); await next(); - ctx.update({ loading: false }); + loading.v = false; clearTimeout(timer); }; From 40068d4ace0eabbf1d7249a90e88c6fca92f102d Mon Sep 17 00:00:00 2001 From: zoffy <2601204674@qq.com> Date: Wed, 28 Aug 2024 18:13:17 +0800 Subject: [PATCH 2/7] doc: fix taro.md (#53) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by:   < > --- docs/resource/01-request-adapter/06-taro.md | 12 ++++++------ .../current/resource/01-request-adapter/06-taro.md | 12 ++++++------ .../08-request-adapter/04-alova-adapter-taro.md | 12 ++++++------ .../08-request-adapter/04-alova-adapter-taro.md | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/resource/01-request-adapter/06-taro.md b/docs/resource/01-request-adapter/06-taro.md index 35070d323f..a9698df343 100644 --- a/docs/resource/01-request-adapter/06-taro.md +++ b/docs/resource/01-request-adapter/06-taro.md @@ -162,11 +162,11 @@ const uploadFile = (name, filePath, formData) => name, filePath, - // Additional data will be passed into formData of uni.uploadFile + // Additional data will be passed into formData of Taro.uploadFile ...formData }, { - // Set the request method to upload, and the adapter will call uni.uploadFile + // Set the request method to upload, and the adapter will call Taro.uploadFile requestType: 'upload' } ); @@ -216,11 +216,11 @@ const App = () => { name, filePath, - // Additional data will be passed into formData of uni.uploadFile + // Additional data will be passed into formData of Taro.uploadFile ...formData }, { - // Set the request method to upload, and the adapter will call uni.uploadFile + // Set the request method to upload, and the adapter will call Taro.uploadFile requestType: 'upload' } ); @@ -258,7 +258,7 @@ Similarly, it is fully compatible with `Taro.downloadFile`, you can specify [all ```jsx const downloadFile = filePath => alovaInst.Get('/bigImage.jpg', { - // Set the request method to download, and the adapter will call uni.downloadFile + // Set the request method to download, and the adapter will call Taro.downloadFile requestType: 'download', filePath }); @@ -294,7 +294,7 @@ const App = () => { + +`, + hidden: true + }, + ...commonConfig.files + }, + customSetup: { + entry: '/index.js', + dependencies: { + svelte: '^1.8.19', + ...commonConfig.customSetup.dependencies + } + }, + main: '/App.jsx', + environment: 'solid' }) };