美文网首页
mixin全局混入

mixin全局混入

作者: Cherry9507 | 来源:发表于2021-05-18 10:37 被阅读0次
    import Vue from 'vue';
    
    Vue.mixin({
        data() {
            return {
                uploading: ''
            }
        },
        methods: {
            // 表格行背景色
            tableRowClassName(row) {
                // 表格行背景色
                if (row.rowIndex % 2 == 1) {
                    return "warning-row";
                } else {
                    return "success-row";
                }
            },
    
            /**
             * 表单重置
             * @param {string} formName 
             */
            resetForm(formName) {
                if (formName == 'selectForm') {
                    this.selectForm = this.$options.data().selectForm;
                    this.pageInfo.pageNum = 1;
                    this.getTableData();
                } else if (formName == 'editorForm') {
                    this.editorForm = this.$options.data().editorForm;
                }
            },
    
            // 头部表单查询
            formSelect() {
                this.pageInfo.pageNum = 1;
                this.getTableData();
            },
    
         
            // 自定义序号
            indexMethod(index) {
                return (this.pageInfo.pageNum - 1) * this.pageInfo.pageSize + index + 1;
            },
    
    
        },
        created() {}
    })
    

    需要用到mixin的页面引入该文件直接当本页面属性、或方法调用即可。

    相关文章

      网友评论

          本文标题:mixin全局混入

          本文链接:https://www.haomeiwen.com/subject/ezyejltx.html