vue/js 怎么实现单选、多选、全选、全不选、

一:做成的效果图
vue/js 怎么实现单选、多选、全选、全不选、_第1张图片
二:代码展示
1:html
vue/js 怎么实现单选、多选、全选、全不选、_第2张图片
2:js
vue/js 怎么实现单选、多选、全选、全不选、_第3张图片

       
{{val.roleName}}

已选择{{followSelectedList.length}}人
确定
             handleCheckChange (userId,userName) {
				let idx = vm.followSelectedList.indexOf(userId);
				let idx2 = vm.followSelectedListValue.indexOf(userName);
				idx >= 0 ? vm.followSelectedList.splice(idx, 1) : vm.followSelectedList.push(userId);
				idx2 >= 0 ? vm.followSelectedListValue.splice(idx2, 1) : vm.followSelectedListValue.push(userName);
              },
				handleCheckAllChange () {
					vm.checkAll = !vm.checkAll;
					if (vm.checkAll) {
						vm.followSelectedList = [];
						vm.followSelectedListValue = [];
						vm.arrData.forEach(val => {
							vm.followSelectedList.push(val.userId);
							vm.followSelectedListValue.push(val.userName);
						}, vm);
						return;
					}
					vm.followSelectedList = [];
					vm.followSelectedListValue = [];
				},

你可能感兴趣的:(vue/js 怎么实现单选、多选、全选、全不选、)