其他分享
首页 > 其他分享> > vue 混合器mixins

vue 混合器mixins

作者:互联网

引入混合器的页面都会先在本页面mounted之前执行混合器的代码

<script>
import {logMixins} from '@/utils/masterLogMixins.js';
export default {
    name: "DailyWork",
    mixins: [logMixins],
    data: function() {
        return {
        };
    },
    props: {
    },
    computed: {
    },
    components: {
    },
    watch: {
    },
    methods: {
    },
    created() {
    },
    mounted: async function() {
    }
};
</script>

masterLogMixins.js

import {voxTianShuLog} from "@/utils/index";
export const logMixins = {
    data() {
        return {
            masterLogS0: {}
        };
    },
    computed: {
    },
    components: {
    },
    watch: {
    },
    methods: {
    },
    mounted() {
        let vm = this;
        vm.masterLogS0 = {
            area_name: "1111",
            school_name: "1111",
            user_role: 0, //0 教研员 1校长 2教务老师 3局长 4区域管理者
            page_name: "1111",
        };

        voxTianShuLog({
            module: "m_NdRCbETke0",
            op: "o_e0a2YE3VPQ",
            s0: JSON.stringify(Object.assign({}, vm.masterLogS0, {screen_hight: window.screen.height, screen_width: window.screen.width}))
        });
    }
};

标签:vue,name,混合器,screen,mixins,vm,1111,mounted
来源: https://blog.csdn.net/wei_dan1129/article/details/121799449