uni-app新增步骤条(不知道有多少步骤)

1.开发环境 uni-app+uView
2.电脑系统 windows10专业版
3.在使用 uni-app+uView开发的过程中,我们经常在新增的时候新增步骤,但是不知道有多少步骤,因此不能写死,下面我来分享一下我的方法,希望对你有所帮助。
4.废话不所说,直接上代码,在 return 中添加如下代码:

projectstepsObj:{
        num:"0",
        chenarr:[],
        con:"",
      },
      chenarrObj:{
        num:0,
        id:"",
        con:""
      }

5.在新增事件中添加如下代码:

chenfonts(){
      this.projectstepsObj.num+=1;
      this.chenarrObj.num=this.projectstepsObj.num;
      this.chenarrObj.id=this.projectstepsObj.num;
      this.chenarrObj.con="";
      this.projectstepsObj.chenarr.push(this.chenarrObj);

      // console.log(this.projectstepsObj.chenarr);
      
    }

6.在template中添加如下代码:


        
      

7.在提交方法中添加如下代码:

chensubmit() {
    console.log("++++++");
      console.log(this.chenarrObj);
      console.log("--------");
}

8.效果如下:
uni-app新增步骤条(不知道有多少步骤)_第1张图片
9.本期的分享到了这里就结束啦,希望对你有所帮助,让我们一起努力走向巅峰!

你可能感兴趣的:(uni-app)