123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <template>
- <div class="edit-text">
- <el-form
- ref="modalFormComp"
- :model="modalForm"
- :rules="rules"
- :key="modalForm.id"
- label-width="100px"
- >
- <el-form-item prop="content" label="内容:">
- <el-input placeholder="请输入内容" v-model="modalForm.content">
- </el-input>
- </el-form-item>
- </el-form>
- </div>
- </template>
- <script>
- const initModalForm = {
- id: "",
- content: "",
- };
- export default {
- name: "edit-forbid-area",
- props: {
- instance: {
- type: Object,
- default() {
- return {};
- },
- },
- },
- data() {
- return {
- modalForm: { ...initModalForm },
- isBold: false,
- rules: {
- content: [
- {
- required: true,
- message: "请输入文本内容",
- trigger: "change",
- },
- ],
- },
- };
- },
- mounted() {
- this.initData(this.instance);
- },
- methods: {
- initData(val) {
- this.modalForm = { ...val };
- },
- async submit() {
- const valid = await this.$refs.modalFormComp.validate().catch(() => {});
- if (!valid) return;
- this.$emit("modified", this.modalForm);
- },
- },
- };
- </script>
|