最近在对接海康摄像头,需要写一个翻页得功能,于是乎就想到了手写,然后就记录一下。在vue项目里写的
<img
:src="require('')"
alt=""
@click="onNext('delete')"
/>
<img
:src="require('')"
alt=""
@click="onNext('add')"
/>
iDIndex: 0,
onNext(type) {
/**
* console.log('getIChannelID', this.getIChannelID);
* getIChannelID(所有硬盘录像机得通道号)
*/
if (type === "add") {
this.iDIndex++;
} else {
if (this.iDIndex == 0) {
return;
}
this.iDIndex--;
}
WebVideoCtrl.I_StopAllPlay();
this.$nextTick(() => {
const total = this.page * this.page; //窗口数量
let numWindow = total * this.iDIndex; //当前窗口第几页
const length = total * (this.iDIndex + 1); // 当前页到下一页得数量
let index = total * this.iDIndex;
console.log(
"total:",
total,
"numWindow",
numWindow,
"length:",
length,
"index:",
index
);
for (numWindow; numWindow < length; numWindow++) {
if (this.groupVideoList.length > numWindow) {
this.clickStartRealPlay(
this.groupVideoList[numWindow].webChannel,
numWindow - index,
this.groupVideoList[numWindow].webUserId
);
}
}
});
},