Commit f024ab823a6aa97c4b3a65ff9c0f36de20246bc2

Authored by H
1 parent ab249f70

修复modal标题属性首次如果没有值,再赋值的话就会没用

examples/routers/modal.vue
1 1 <template>
2 2 <div>
3 3 <Button type="primary" @click="modal1 = true">显示对话框</Button>
  4 +
4 5 <Modal
5 6 v-model="modal1"
6   - title="普通的Modal对话框标题"
  7 + :title="title"
7 8 @on-ok="ok"
  9 + :mask-closable="false"
8 10 @on-cancel="cancel">
9   - <p>对话框内容</p>
  11 + <p><Button type="ghost" @click="title = '这是标题'">设置标题</Button> {{title}}</p>
10 12 <p>对话框内容</p>
11 13 <p>对话框内容</p>
12 14 </Modal>
... ... @@ -16,7 +18,8 @@
16 18 export default {
17 19 data () {
18 20 return {
19   - modal1: false
  21 + modal1: true,
  22 + title:''
20 23 }
21 24 },
22 25 methods: {
... ...
src/components/modal/modal.vue
... ... @@ -261,6 +261,11 @@
261 261 } else {
262 262 this.removeScrollEffect();
263 263 }
  264 + },
  265 + title (val) {
  266 + if (this.$slots.header === undefined) {
  267 + this.showHead = val?true:false;
  268 + }
264 269 }
265 270 }
266 271 };
... ...