读取常量表

This commit is contained in:
ChenXinXin committed 2024-05-10 14:15:02 +08:00
1 parent bab9515e0b
commit 0bc4b4202e
2 files changed
+42

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
<!-- constantUtil.html start -->
<script>
var constantObj = [];
try {
constantObj = JSON.parse(String.raw`<$ constantObj | dump | safe $>`);
} catch (e) {
console.error('constantObj parse error! ', e);
}
function parseConstantText(value, constantKey) {
let constantItem = (constantObj[constantKey] || []).find(constant => constant.value == value);
return (constantItem || {}).text || value;
}
Vue.filter('parseConstantText', parseConstantText)
</script>
<!-- constantUtil.html end -->