mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
21 lines
559 B
Vue
21 lines
559 B
Vue
<template>
|
|
<Tiptap :model-value="jsonValue" @update:model-value="(v) => setValue(JSON.stringify(v))" />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Tiptap from '@/components/Tiptap.vue'
|
|
import type { RuleExpression } from 'vee-validate'
|
|
const props = defineProps<{
|
|
name: string
|
|
rules?: RuleExpression<string>
|
|
}>()
|
|
const { value, setValue } = useField<string>(props.name, props.rules)
|
|
const jsonValue = computed(() => {
|
|
try {
|
|
return value.value ? JSON.parse(value.value) : {}
|
|
} catch (error) {
|
|
return {}
|
|
}
|
|
})
|
|
</script>
|