From 9057e04efad1b7d61c77a72e5c37a504d0aee935 Mon Sep 17 00:00:00 2001 From: doum <doum> Date: 星期五, 26 九月 2025 09:24:03 +0800 Subject: [PATCH] H5静态化 --- admin/src/components/common/Value.vue | 64 ++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-) diff --git a/admin/src/components/common/Value.vue b/admin/src/components/common/Value.vue new file mode 100644 index 0000000..41e8c7f --- /dev/null +++ b/admin/src/components/common/Value.vue @@ -0,0 +1,64 @@ +<template> + <div class="value"> + <i class="el-icon-loading" v-if="data == null"></i> + <slot v-else>{{getValue()}}{{suffix}}</slot> + </div> +</template> + +<script> +export default { + name: 'Value', + props: { + data: { + type: Object + }, + prop: { + type: String + }, + suffix: { + type: String + }, + handler: { + type: Function + } + }, + methods: { + /** + * 鑾峰彇鍊� + * + * @returns {string} + */ + getValue () { + if (this.data == null) { + return '' + } + if (this.prop == null) { + return this.data + } + const props = this.prop.split('.') + let i = 0 + let value = this.data + while (i < props.length) { + value = value[props[i]] + i++ + } + if (this.handler == null) { + return value + } + return this.handler(value) + } + } +} +</script> + +<style scoped lang="scss"> +.value { + word-break: break-all; + .el-icon-loading { + font-size: 16px; + color: #999; + position: relative; + top: 1px; + } +} +</style> -- Gitblit v1.9.3