mirror of
https://gitee.com/Donal/ofd.js.git
synced 2024-12-02 03:48:44 +08:00
vue 监听屏幕变化计算缩放比例
This commit is contained in:
parent
835defc1fd
commit
a0994e82e1
@ -38,11 +38,25 @@ export default {
|
||||
drawParamResObj: {},
|
||||
multiMediaResObj: {},
|
||||
signatures: null,
|
||||
screenWidth: document.body.clientWidth,
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.file = null;
|
||||
},
|
||||
|
||||
mounted() {
|
||||
let that = this;
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
setPageScal(5)
|
||||
that.screenWidth = (document.body.clientWidth);
|
||||
console.log(that.screenWidth)
|
||||
})()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
uploadFile() {
|
||||
this.signatures = null;
|
||||
@ -350,8 +364,8 @@ export default {
|
||||
if (obj) {
|
||||
let array = obj.split(' ');
|
||||
let width = converterDpi(parseFloat(array[2]));
|
||||
if (width > screen.width) {
|
||||
const scale = (screen.width-5) / parseFloat(array[2]);
|
||||
if (width > this.screenWidth) {
|
||||
const scale = (this.screenWidth-5) / parseFloat(array[2]);
|
||||
setPageScal(scale>0?scale:1);
|
||||
}
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user