beforeConfirm () { this.detailInfos.userPointList.map((item, index) => { if (item.show && !item.rejectReason) { item.showRed = true this.$set(this.detailInfos.userPointList, index, item) } }) setTimeout(() => { document.getElementsByClassName('rejectReason')[0].scrollIntoView({ behavior: 'smooth', // 平滑過渡 block: 'start' // 上邊框與視窗頂部平齊。默認值 }) }, 200) },
以上代碼是做了一個,點擊確認校驗列表rejectreason是否為空的情況