国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Element——table排序,上移下移功能。及按鈕上一條下一條功能

這篇具有很好參考價(jià)值的文章主要介紹了Element——table排序,上移下移功能。及按鈕上一條下一條功能。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

需求:table排序,可操作排序上移下移功能。判斷第一行上移禁用和最后一行下移禁用,排序根據(jù)后端返回的字段

Element——table排序,上移下移功能。及按鈕上一條下一條功能,javascript,前端,elementui文章來源地址http://www.zghlxwxcb.cn/news/detail-682916.html

 <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column type="index" label="序號(hào)" align="center" min-width="50">
        <template slot-scope="scope">
          <span>{{ scope.$index + (pageNum - 1) * pageSize + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="name"
        label="編號(hào)"
        width="180">
      </el-table-column>
      <el-table-column
        prop="address"
        label="排序">
         <template slot-scope="scope">
			<el-button
                  type="text"
                  disabled={index === 0}
                  @click={e => this.sortFunction(e, row, "1")}
                >
                  上移
                </el-button>
                <el-button
                  type="text"
                  disabled={index === this.tableData.length - 1}
                  @click={e => this.sortFunction(e, row, "2")}
                >
                  下移
                </el-button>
            </el-table-column>
      </el-table-column>
      <el-table-column prop="address" label="操作" min-width="200" align="center">
        <template slot-scope="scope">
          <el-button
            >編輯
          </el-button>

          <el-button  @click="handleDelete(scope.row)"
            >刪除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
sortFunction(e, row, type) {
      changeSort({//排序接口
        sortType: type,
        templateConfigId: row.templateConfigId
      }).then(res => {
        if (res.code === 200) {
          this.getList();//獲取表格接口
        }
      });
    },

按鈕上一條下一條功能

            <div class="right-bottom">
              <el-button
                class="end-upon btns"
                :disabled="uponindex === 0"
                :class="isEndBtn === true ? 'isActive' : ''"
                @click="endUponClick()"
                >上一條</el-button
              >
              <el-button
                class="end-next btns"
                :disabled="isDisabled"
                :class="isNextBtn === true ? 'isActive' : ''"
                @click="endNextClick()"
                >下一條</el-button
              >
            </div>
//上一條按鈕
    endUponClick() {
      //存老的值 oldName
      let oldName = this.activeName;//this.activeName 當(dāng)前選中的那一條數(shù)據(jù)
      let addNum = this.activeName - 1;
      this.tabsList.forEach((item, index) => {
        if (addNum === 0) {
          this.isEndBtn = true;
          this.isBtnDisabled = true;
          this.isNextBtn = false;
          this.$message({
            message: '此項(xiàng)為第一條數(shù)據(jù)',
            type: 'warning'
          });
        }
        if (addNum === item.sort) {
          this.activeName = addNum;
          if (item.testStatus === '2') {
            this.onSetShow = true;
          } else {
            this.onSetShow = false;
          }
          //當(dāng)前選中的那一條
          this.tabsList.forEach(v => {
            if (oldName === v.sort) {
              this.contentCode = v.contentCode;
              this.debugContent = v.debugContent;
              this.testStatus = v.testStatus;
              this.dataRecordResultList = v.dataRecordResult;
            }
          });
          this.isEndBtn = true;
          this.isNextBtn = false;
          this.activeName = addNum;
          this.updateInfo(this.dataRecordResultList);
        }
      });
    },

//下一條按鈕
    endNextClick() {
      //存老的值 oldName
      let oldName = this.activeName;//this.activeName 當(dāng)前選中的那一條數(shù)據(jù)
      let addNum = this.activeName + 1;
      let lengthNum = this.tabsList.length + 1;
      this.tabsList.forEach((item, index) => {
        if (addNum === lengthNum) {
          this.isNextBtn = true;
          this.isEndBtn = false;
          this.isBtnDisabled = true;
          this.$message({
            message: '此項(xiàng)為最后一條數(shù)據(jù)',
            type: 'warning'
          });
        } else {
          if (addNum === item.sort) {
            this.activeName = addNum;
            if (item.testStatus === '2') {
              this.onSetShow = true;
            } else {
              this.onSetShow = false;
            }
            //當(dāng)前選中的那一條
            this.tabsList.forEach(v => {
              if (oldName === v.sort) {
                this.contentCode = v.contentCode;
                this.debugContent = v.debugContent;
                this.testStatus = v.testStatus;
                this.dataRecordResultList = v.dataRecordResult;
              }
            });
            this.isNextBtn = true;
            this.isEndBtn = false;
            this.activeName = addNum;
            this.updateInfo(this.dataRecordResultList);
          }
        }
      });
    },

到了這里,關(guān)于Element——table排序,上移下移功能。及按鈕上一條下一條功能的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包