show validator names

This commit is contained in:
liangping 2023-05-22 15:21:42 +08:00
parent 1cfc49e9a9
commit 9d2961085a

View File

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useFormatter } from '@/stores'; import { useFormatter } from '@/stores';
import MdEditor from 'md-editor-v3'; import MdEditor from 'md-editor-v3';
import { computed } from 'vue';
const props = defineProps(['value']); const props = defineProps(['value']);
const format = useFormatter(); const format = useFormatter();
@ -13,6 +14,17 @@ function isMD() {
} }
return false; return false;
} }
const text = computed(() => {
if(!props.value) return ""
const v = props.value
switch(true) {
case v.length === 28 && v.endsWith("="): {
return format.validator(v)
}
}
return v
})
</script> </script>
<template> <template>
<MdEditor <MdEditor
@ -21,7 +33,7 @@ function isMD() {
previewOnly previewOnly
class="md-editor-recover" class="md-editor-recover"
></MdEditor> ></MdEditor>
<span v-else>{{ value }}</span> <span v-else>{{ text }}-</span>
</template> </template>
<style lang="scss"> <style lang="scss">