源码讲解
/* 定义表单 */
const ezForm = reactive({
input: '',
output: '',
})
// 确保在计算行数前,文本不是undefined或空字符串
const getLineCount = (textValue: string) => textValue ? textValue.split('\n').length : 0
// 计算原始行数
const originalLineCount = computed(() => getLineCount(ezForm.input))
// 计算去重后的行数
const deduplicatedLineCount = computed(() => getLineCount(ezForm.output))
// 计算减少的行数
const reducedLineCount = computed(() => originalLineCount.value - deduplicatedLineCount.value)