添加内容过滤功能
This commit is contained in:
@@ -94,6 +94,19 @@ export function toast(message) {
|
||||
Taro.showToast({ title: message, icon: "none" });
|
||||
}
|
||||
|
||||
/** 从接口/请求错误中取出后端返回的文案,用于保存失败等场景的 toast */
|
||||
export function getBackendErrorMsg(error: any, fallback = "操作失败"): string {
|
||||
if (error == null) return fallback;
|
||||
const msg =
|
||||
error?.message ||
|
||||
(typeof error?.error === "string" ? error.error : error?.error?.message) ||
|
||||
error?.data?.message ||
|
||||
error?.data?.msg ||
|
||||
"";
|
||||
const s = String(msg).trim();
|
||||
return s || fallback;
|
||||
}
|
||||
|
||||
// 将·作为连接符插入到标签文本之间
|
||||
export function insertDotInTags(tags: string[]) {
|
||||
if (!tags) return [];
|
||||
|
||||
Reference in New Issue
Block a user