Files
sk_fems_ui/mixin/resize.js
2025-07-12 15:13:46 +09:00

70 lines
1.6 KiB
JavaScript

import { mapState, mapMutations, mapActions } from 'vuex';
export const resize = {
data() {
return {
resize: false,
};
},
computed: {
...mapState({
stateData: state => state.activeMenuInfo.prgmId,
}),
},
watch: {
// $route(to, from){
// console.log('to.query.prgmId',to.query.prgmId);
// // console.log('this.stateData.prgmId',this.stateData.prgmId);
// if(to.query.prgmId == this.stateData){
// this.resize= true;
// }
// },
stateData(val) {
// window.trigger('resize');
// window.addEventListener('resize', this.handlerResize);
// console.log("val : ", val);
// if(val == this.$router.currentRoute.query.prgmId){
// this.resize = true;
// }
},
resize(val) {
if (val) {
// console.log("this.loadGrid", this.loadGrid);
let refs = this.$refs;
// if(this.stateData == this.myPrgmId){
for (var key of Object.keys(refs)) {
if (refs[key].$refs != undefined) {
for (var key2 of Object.keys(refs[key].$refs)) {
if (key2.includes('tuigrid')) {
this.$refs[key].refreshGrid();
}
}
}
}
// }
this.resize = false;
}
},
},
beforeCreate() {
// console.log("mixin beforeCreate");
},
created() {
// console.log("mixin created");
},
mounted() {
window.addEventListener('resize', this.handlerResize);
// console.log("mixin mounted", this.myPrgmId);
//this.init();
},
beforeDestroy() {
// console.log("mixin beforeDestroy");
window.removeEventListener('resize', this.handlerResize);
this.chkOpenTabList({ key: 'destroy', prgmId: this.myPrgmId });
},
methods: {
handlerResize() {
this.resize = true;
},
},
};