@lemonadejs/calendar
Version:
LemonadeJS reactive JavaScript calendar plugin
48 lines (44 loc) • 1.19 kB
JavaScript
import { h } from 'vue';
import component from "./index";
export default {
inheritAttrs: false,
mounted() {
this.$nextTick(() => {
let options = {
...this.$attrs
};
this.current = component(this.$refs.container, options);
});
},
setup() {
let containerProps = {
ref: 'container',
style: {
width: '100%',
height: '100%',
}
};
return () => h('div', containerProps);
},
watch: {
$attrs: {
deep: true,
handler() {
this.updateState();
}
}
},
methods: {
updateState() {
if (this.current) {
for (let key in this.$attrs) {
if (this.$attrs.hasOwnProperty(key) && this.current.hasOwnProperty(key)) {
if (this.$attrs[key] !== this.current[key]) {
this.current[key] = this.$attrs[key];
}
}
}
}
}
}
}