codercup / unibest

unibest - 最好用的 uniapp 开发框架。unibest 是由 uniapp + Vue3 + Ts + Vite4 + UnoCss + UniUI 驱动的跨端快速启动模板,使用 VS Code 开发,具有代码提示、自动格式化、统一配置、代码片段等功能,同时内置了大量平时开发常用的基本组件,开箱即用,让你编写 uniapp 拥有 best 体验。
https://codercup.github.io/unibest-docs/
MIT License
1.29k stars 172 forks source link

关于 useRequest 的相关问题 #84

Open tlerbao opened 1 month ago

tlerbao commented 1 month ago

后端菜鸡虚心请教,问题可能比较初级,见笑了。

一、似乎 initialData 参数目前完全没用

二、对于一个页面有多个请求的时候 ,data、run 等变量重复一般是怎么处理的?

const { loading, error, data, run } = useRequest(() => getUserListApi())

我以前都是这面这么用,不套 useRequest

<script lang="ts" setup>
const userList = ref()
const getUserList = async () => {
  const { data } = await getUserListApi()
  userList.value = data
}
getUserList()
</script>

三、路由白名单的示例代码有吗?

四、准备做企业微信内的小程序,必须登录,有代码示例或者思路吗,也是写在路由拦截里吗?

codercup commented 6 days ago

路由白名单示例代码在demo模板

codercup commented 6 days ago

必须登录的目前只能在App.vue的onLaunch和onShow里面处理

tlerbao commented 5 days ago

必须登录的目前只能在App.vue的onLaunch和onShow里面处理 整个小程序必须登录的话 好像在onLaunch和onShow里判断是否已经登录然后跳转到 login 页面

会先闪一下当前页内容框架然后再跳转到 login,这个怎么解决呢?

codercup commented 5 days ago

目前我也没有好的办法。

飞鸽传书 @.***

---原始邮件--- 发件人: @.> 发送时间: 2024年6月30日(周日) 晚上9:53 收件人: @.>; 抄送: @.**@.>; 主题: Re: [codercup/unibest] 关于 useRequest 的相关问题 (Issue #84)

必须登录的目前只能在App.vue的onLaunch和onShow里面处理 整个小程序必须登录的话 好像在onLaunch和onShow里判断是否已经登录然后跳转到 login 页面

会先闪一下当前页内容框架然后再跳转到 login,这个怎么解决呢?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>