mixins.js 1.33 KB
import {
    getToken
} from '@/utils/auth'
import { BASE_URL } from '@/common/config'
import { formatTime } from '@/utils/util'
export default {
    data() {
        return {
            Authorization: '',
            BASE_ROOT_DOMAIN: BASE_URL,
            BASE_URL: BASE_URL
        };
    },
    created() {
        this.Authorization = getToken();
    },
    filters: {
        dateTimeFilter(val, formatter) {
            return formatTime(val, formatter)
        },
    },
    methods: {
        initRem() {
            var html = document.documentElement;
            var w = html.getBoundingClientRect().width;
            var fontSize = w / 1000;
            html.style.fontSize = fontSize + "px";

            if (this.echartOption1) {
                this.echartOption1.textStyle = {
                    fontSize: fontSize * 9
                };
            }
            if (this.echartOption2) {
                this.echartOption2.textStyle = {
                    fontSize: fontSize * 9
                };
            }
            if (this.echartOption3) {
                this.echartOption3.textStyle = {
                    fontSize: fontSize * 9
                };
            }
            if (this.resetChart) {
                setTimeout(() => {
                    this.resetChart()
                }, 2000)
            }
        },
    }
}