uniapp new list

Requirement: Dynamically add list values ​​on the mini program;

Click Add and an input box will appear at the top

Method to realize:

Redefine assignment to list;

            //添加事件
			add() {
				var params = {
					names: null
				}
				// 解决添加时从上不添加,便于操作
                // 临时列表
				var tempList=[]
				tempList.push(params)
                // 拼接列表
				tempList=tempList.concat(this.workTypeVO.cvihWorkTypes)
                // 重新赋值给对象 this.workTypeVO 包含list列表的对象 
                //cvihWorkTypes 对象中列表对象名称,
                //tempList 临时新对象;
				this.$set(this.workTypeVO,'cvihWorkTypes',tempList)				
			}

Guess you like

Origin blog.csdn.net/xingfaup/article/details/121210175