<script setup lang="ts">
// 单元格点击编辑器（风险记录表/插件表格通用）
import { ref } from "vue";
const props = defineProps<{ v: string }>();
const emit = defineEmits<{ update: [x: string] }>();
const ed = ref(false);
const val = ref(props.v);
const start = () => { val.value = props.v; ed.value = true; };
const done = () => { ed.value = false; if (val.value !== props.v) emit("update", val.value); };
</script>
<template>
    <NInput v-if="ed" class="text-xs" v-model:value="val" type="textarea" autofocus rows="3" @blur="done" />
  <p v-else @click="start" title="点击修改"
    class="cursor-pointer w-full rounded px-1 py-0.5 text-left text-xs leading-relaxed text-slate-700 transition hover:bg-[#EAF0F9]">
    <template v-if="v">{{ v }}</template>
    <span v-else class="text-slate-300">请输入</span>
  </p>
</template>
