Message: add closeOnHashChange, update docs

This commit is contained in:
Leopoldthecoder
2017-07-24 19:09:36 +08:00
committed by 杨奕
parent 97183e3bc6
commit 798bb8e75d
7 changed files with 96 additions and 17 deletions

View File

@@ -12,7 +12,7 @@
<div class="el-message-box__content" v-if="message !== ''">
<div class="el-message-box__status" :class="[ typeClass ]"></div>
<div class="el-message-box__message" :style="{ 'margin-left': typeClass ? '50px' : '0' }">
<slot><p>{{ message }}</p></slot>
<slot><p v-html="message"></p></slot>
</div>
<div class="el-message-box__input" v-show="showInput">
<el-input v-model="inputValue" @keyup.enter.native="handleAction('confirm')" :placeholder="inputPlaceholder" ref="input"></el-input>
@@ -75,6 +75,9 @@
},
closeOnPressEscape: {
default: true
},
closeOnHashChange: {
default: true
}
},
@@ -210,6 +213,18 @@
}
},
mounted() {
if (this.closeOnHashChange) {
window.addEventListener('hashchange', this.close);
}
},
beforeDestroy() {
if (this.closeOnHashChange) {
window.removeEventListener('hashchange', this.close);
}
},
data() {
return {
uid: 1,