weaver_trunk_cli/pc4mobx/prj/stores/commonStore.js

32 lines
880 B
JavaScript

import { observable, action } from 'mobx';
export class CommonStore{
@action
getContentHeight=()=>{
let height = document.documentElement.clientHeight;
return height;
}
@observable contentHeight = this.getContentHeight();
// @observable dialogWidth = $(window.top).width()*0.8>1000?1000:$(window.top).width()*0.8;
// @observable dialogHeight = $(window.top).height()*0.8;
timer;
constructor() {
window.onresize = this.resize
}
@action
resize = () => {
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.contentHeight = this.getContentHeight();
// this.dialogWidth = $(window.top).width()*0.8>1000?1000:$(window.top).width()*0.8;
// this.dialogHeight = $(window.top).height()*0.8;
}, 100);
}
}
export default new CommonStore()