From 8912fa409de9ff6e7c38a723ec5184c651e6a28d Mon Sep 17 00:00:00 2001 From: aringlai Date: Tue, 2 Feb 2021 18:10:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9E=9A=E4=B8=BE=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6readonly=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-enums/src/runtime/core.tpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/fes-plugin-enums/src/runtime/core.tpl b/packages/fes-plugin-enums/src/runtime/core.tpl index e5789ce1..325a59d7 100644 --- a/packages/fes-plugin-enums/src/runtime/core.tpl +++ b/packages/fes-plugin-enums/src/runtime/core.tpl @@ -25,13 +25,15 @@ function get(name, key, opt = { dir: 'value', extend: []}) { key = '' } let list = ENUMS[name] || [] + let value if (key) { let res = list.filter(item => item.key === key)[0] if (!res) return key - return readonly(parseValueDir(res.value, opt.dir) || key) + value = parseValueDir(res.value, opt.dir) || key } else { - return readonly(format(list, opt.extend)) + value = format(list, opt.extend) } + return typeof value === 'object' ? readonly(value) : value } /**