前端(实际开发总结)2

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'})
      })
    },
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值