fix: 不显示问题

This commit is contained in:
2023-07-23 17:54:38 +08:00
parent a677dd8cf1
commit 2737b0aa83

View File

@ -2,7 +2,7 @@
* @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-07-23 16:27:37
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-07-23 17:28:40
* @LastEditTime: 2023-07-23 17:54:15
* @FilePath: \vue3\packages\mask-text\index.vue
* @Description: 敏感数据隐藏组件
*
@ -26,13 +26,14 @@ const props = withDefaults(defineProps<{
const [value, toggle] = useToggle(true)
const data = computed(() => {
if (!value.value || !props.text)
if (!props.text)
return ''
const left = props.left < 0 ? 0 : props.left
const right = props.right < 0 ? 0 : props.right
const textLength = props.text.length
if (left > textLength
if (!value.value
|| left > textLength
|| right > textLength
|| right + left > textLength
)