37 lines
850 B
JavaScript
37 lines
850 B
JavaScript
import Vue from 'vue';
|
|
/**
|
|
* Bootable
|
|
* @mixin
|
|
*
|
|
* Used to add lazy content functionality to components
|
|
* Looks for change in "isActive" to automatically boot
|
|
* Otherwise can be set manually
|
|
*/
|
|
/* @vue/component */
|
|
export default Vue.extend().extend({
|
|
name: 'bootable',
|
|
props: {
|
|
lazy: Boolean
|
|
},
|
|
data: function data() {
|
|
return {
|
|
isBooted: false
|
|
};
|
|
},
|
|
computed: {
|
|
hasContent: function hasContent() {
|
|
return this.isBooted || !this.lazy || this.isActive;
|
|
}
|
|
},
|
|
watch: {
|
|
isActive: function isActive() {
|
|
this.isBooted = true;
|
|
}
|
|
},
|
|
methods: {
|
|
showLazyContent: function showLazyContent(content) {
|
|
return this.hasContent ? content : undefined;
|
|
}
|
|
}
|
|
});
|
|
//# sourceMappingURL=bootable.js.map
|