<template>
  <template v-if="mode === 'DESIGN'">
    <el-input size="medium" disabled :placeholder="placeholder" show-word-limit :rows="2" type="textarea"/>
  </template>
  <template v-else>
    <template v-if="perm === 'E'">
      <el-input size="medium" v-model="_value" clearable :maxlength="255" :placeholder="placeholder" show-word-limit
                :rows="3" type="textarea"/>
    </template>
    <template v-else-if="perm === 'R'">
      <span>{{ _value }}</span>
    </template>
  </template>
</template>

<script setup>
import {defineProps,defineEmits} from 'vue'
const emit = defineEmits()

const props = defineProps({
  mode:{
    type: String,
    default: 'DESIGN'
  },
  required:{
    type: Boolean,
    default: false
  },
  value: {
    type: String,
    default: null
  },
  perm: {
    type: String,
    default: 'E'
  },
  placeholder: {
    type: String,
    default: '请输入内容'
  }
})
const _value = computed({
  get() {
    return props.value;
  },
  set(value) {
    emit('update:value', value)
  }
})
watch(()=>props.value,(value)=>{
  _value.value = value
})

</script>

<style scoped>

</style>
