1.ElementUI中表单验证下面的提示文字
这里好像少一步也不行,就按这个走吧,第一次写这个提示,
这里逻辑应该是valid代表着是不是输入框为空值,空值返回false。
2.获取ElementUi中table的type=‘index’
这个普通的scope.row获取不到,需要额外获取。
3.遇到的错误
TypeError: (void 0) is not a function
这种错误,是发送请求成功了,但是没有数据,所以你需要判断下数据有没有,判断一下,给出提示,length那
4.vue+element-ui项目的分页,返回默认分页高亮样式的问题
这里出现了使用分页效果,跳转界面,再跳转回来时界面正确,但是高亮角标显示不是当前页的页脚,是1,查了一下,我的理解是获取总数目实在created之前的,到了created虽然获取到了总数目totalNum,但是分页组件也不会变化了,所以这里我的解决办法是按照他说的v-if,因为这里已经获取到了当前页currentPage,只是,总数目totalNum为0而已,已经在data中修改了currentPage的值了,我们等到拉取到总数目的时候,再创建这个分页条就好了,反正都是在created里拉取的。所以问题得到了解决。
这里有另外一个感受哈,不知道对不对,跳转和刷新,store中的数据一个是不会消失,一个是消失。
<!-- 这里解决了分页高亮为1的bug,使用v-if -->
<el-pagination @current-change="handleCurrent" :current-page.sync="currentPage" :page-size="pageSize"
layout="total,prev, pager, next, jumper" :total="totalCount" v-if="totalCount !== 0"></el-pagination>
created: function () {
//这里是从store中拉取的,别在意
if (this.X_RECEIVABLES_CONDITION.CONDITION) {
this.searchForm = this.X_RECEIVABLES_CONDITION.CONDITION;
this.currentPage = this.X_RECEIVABLES_CONDITION.CURRENT_PAGE;
console.log(this.currentPage)
} else {
this.currentPage = 1;
console.log('222')
}
this.queryTable()
},
// 拉去数据 不写methods了
queryTable () {
let params = {
SERVICE_ID: '15060',
OTYPE: 1,
TC_ID: Number(sessionStorage.getItem('companyId')),
PAGESIZE: this.pageSize,
PAGEINDEX: this.currentPage - 1
}
if (this.searchForm.status || this.searchForm.status === 0) {
params.STATUS = this.searchForm.status
}
if (this.searchForm.type) {
params.INCOME_TYPE = this.searchForm.type
}
http.post(params)
.then(result => {
if (result.length!==0) {
this.totalCount = result[0].TOTAL
this.tableData = result[1].list
this.$store.dispatch("SET_X_RECEIVABLES_CONDITION", {
CONDITION: this.searchForm,
DATA: this.tableData,
TOTAL_COUNT: this.totalCount,
CURRENT_PAGE: this.currentPage
})
}else {
this.$message.show({text: '暂无数据', type: 'success'})
this.tableData = []
}
}).catch(error => {
this.$message.show({text: error, type: 'error'})
})
},