[Improvement] Actionsheet: support lazy render (#1365)

This commit is contained in:
neverland
2018-06-29 20:34:55 +08:00
committed by GitHub
parent 35a28df51f
commit 0afbd92d32
8 changed files with 27 additions and 60 deletions
+18
View File
@@ -26,11 +26,29 @@ export default {
lockScroll: {
type: Boolean,
default: true
},
// whether to lazy render
lazyRender: {
type: Boolean,
default: true
}
},
data() {
return {
inited: this.value
};
},
computed: {
shouldRender() {
return this.inited || !this.lazyRender;
}
},
watch: {
value(val) {
this.inited = this.inited || this.value;
this[val ? 'open' : 'close']();
},