1. 第一个问题,dialogue 组件会展现上一次关上的数据
解决:dialog 组件增加 v -if
<el-dialog
:title="dialogTitle"
:visible.sync="popVisible"
v-if="popVisible"
width="50%"
>
<el-form
:ref="pageName"
:rules="rules"
:model="notice"
label-width="140px"
>
<el-form-item label="ID" prop="id">
<el-input
v-model="notice.id"
placeholder="请输出 ID(步长 10)"
></el-input>
</el-form-item>
<el-form-item label="标签" prop="key">
<el-input v-model="notice.key" placeholder="请输出标签"></el-input>
</el-form-item>
<el-form-item label="文案" prop="message">
<el-input
v-model="notice.message"
type="textarea"
placeholder="请输出文案"
></el-input>
</el-form-item>
<el-form-item label="模板" prop="tpl">
<el-select v-model="notice.tpl" width="100">
<el-option value="common" label="专用"> 专用 </el-option>
<el-option
v-for="(item, key) in options.webConfigKV['tpl']"
:key="key"
:value="key"
:label="item"
>{{item}}</el-option
></el-select
>
</el-form-item>
<el-form-item label="备注" prop="memo">
<el-input v-model="notice.memo" placeholder="请输出备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="popVisible = false"> 取 消 </el-button>
<el-button type="primary" @click="save" :disabled="btnDisabled"
> 确 定 </el-button
>
</span>
</el-dialog>