<template>
  <a-textarea :type="type" :value="modelValue" @input="updateValue" :disabled="see || disabled || readonly" :rows="rows" :style="style" :placeholder="placeholder" v-bind="$attrs"/>
</template>

<script>
export default {
  name: "PaasTextarea",
  inheritAttrs: false, // 禁用自动继承，手动控制透传
  computed: {
    see() {
      return this.$store?.forms?.see || false;
    }
  },
  props: {
    placeholder: {
      type: String,
      default: "",
    },
    rows: {
      type: Number,
      default: 10
    },
    type: {
      type: String,
      default: "text"
    },
    modelValue: {
      type: [String, Number, Object],
      default: ""
    },
    readonly: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    },
    style: { type: [String, Object], default: "width: 100%;" }
  },
  emits: ["update:modelValue"],
  methods: {
    updateValue(event) {
      this.$emit("update:modelValue", event.target.value);
    }
  }
};
</script>