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();
},
// 自定義序號(hào)
indexMethod(index) {
return (this.pageInfo.pageNum - 1) * this.pageInfo.pageSize + index + 1;
},
},
created() {}
})
需要用到mixin的頁面引入該文件直接當(dāng)本頁面屬性、或方法調(diào)用即可懂算。