|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-10-12 13:56:13
|
|
|
|
|
* @LastEditTime: 2021-10-29 11:16:19
|
|
|
|
|
* @LastEditTime: 2021-11-02 11:19:16
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Edit
|
|
|
|
|
* @FilePath: /data-show/src/mixins/index.js
|
|
|
|
@ -13,7 +13,7 @@ export default {
|
|
|
|
|
Vue.mixin({
|
|
|
|
|
directives: {
|
|
|
|
|
'loading': Loading,
|
|
|
|
|
resize: { // 指令的名称
|
|
|
|
|
resize: { // 指令的名称
|
|
|
|
|
bind(el, binding) { // el为绑定的元素,binding为绑定给指令的对象
|
|
|
|
|
// console.log(el, "绑定", binding);
|
|
|
|
|
let width = '', height = '';
|
|
|
|
@ -31,6 +31,33 @@ export default {
|
|
|
|
|
// console.log(el, "解绑");
|
|
|
|
|
clearInterval(el.__vueSetInterval__);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
highly: {
|
|
|
|
|
bind(el) { // el为绑定的元素,binding为绑定给指令的对象
|
|
|
|
|
// console.log(el, "绑定", binding);
|
|
|
|
|
function adaptive() {
|
|
|
|
|
const style = document.defaultView.getComputedStyle(el); // 获取元素
|
|
|
|
|
const wh = document.body.clientHeight;
|
|
|
|
|
const height = style.height;
|
|
|
|
|
let z = 1;
|
|
|
|
|
let gh = 1080;
|
|
|
|
|
if(wh >= gh) {
|
|
|
|
|
z = 1;
|
|
|
|
|
} else if(wh >= 760 && wh < gh) {
|
|
|
|
|
z = wh / gh
|
|
|
|
|
} else {
|
|
|
|
|
z = 760 / gh
|
|
|
|
|
}
|
|
|
|
|
el.style.height = z * parseFloat(height) + 'px';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
adaptive();
|
|
|
|
|
// el.__vueSetInterval__ = setInterval(adaptive, 300);
|
|
|
|
|
},
|
|
|
|
|
unbind(el) {
|
|
|
|
|
// console.log(el, "解绑");
|
|
|
|
|
clearInterval(el.__vueSetInterval__);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|