hookehuyr

fix(api): 修复请求失败时未处理data为null的情况

当接口返回的data为null时,使用可选链操作符提供默认错误提示,避免undefined错误
/*
* @Date: 2022-05-18 22:56:08
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-12 22:50:45
* @LastEditTime: 2025-09-16 21:56:59
* @FilePath: /lls_program/src/api/fn.js
* @Description: 文件描述
*/
......@@ -29,7 +29,7 @@ export const fn = (api, options = {}) => {
// 只有在非静默模式下才显示错误提示
if (!silent) {
Taro.showToast({
title: res.data.msg,
title: res?.data?.msg || '请求失败',
icon: 'none',
duration: 2000
});
......