2019-04-17 15:58:15 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
value: true
|
|
|
|
});
|
|
|
|
|
|
|
|
var _vue = require('vue');
|
|
|
|
|
|
|
|
var _vue2 = _interopRequireDefault(_vue);
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 */
|
|
|
|
exports.default = _vue2.default.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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2019-06-04 14:29:48 +02:00
|
|
|
//# sourceMappingURL=bootable.js.map
|