feat:样品分析

This commit is contained in:
houjunxiang
2025-10-14 18:16:51 +08:00
parent b5aed8573a
commit 5916b8c833
14 changed files with 574 additions and 671 deletions

View File

@@ -713,6 +713,24 @@ const uuid = () => {
return uuid
}
// 自定义 replacer将函数转换为字符串。json序列化和反序列化时避免函数丢失
function replacer(key, value) {
if (typeof value === 'function') {
return value.toString()
}
return value
}
// 自定义 reviver将字符串转换回函数.json序列化和反序列化时避免函数丢失
const functionKeys = ['change', 'dicFormatter']
function reviver(key, value) {
if (functionKeys.includes(key)) {
// 将字符串转换为函数
return new Function('return ' + value)()
}
return value
}
export default {
range,
getPx,
@@ -745,5 +763,7 @@ export default {
getRootUrl,
copyText,
showToast,
uuid
uuid,
replacer,
reviver
}