欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue長按事件touch示例詳解

 更新時(shí)間:2022年07月12日 11:20:17   作者:陣雨丶  
這篇文章主要介紹了vue長按事件touch,文末給大家補(bǔ)充介紹了Vue長按觸摸事件的實(shí)現(xiàn)代碼,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

1.touch事件

以下是四種touch事件

touchstart:     //手指放到屏幕上時(shí)觸發(fā)

touchmove:      //手指在屏幕上滑動(dòng)式觸發(fā)

touchend:    //手指離開屏幕時(shí)觸發(fā)

touchcancel:     //系統(tǒng)取消touch事件的時(shí)候觸發(fā),這個(gè)好像比較少用

2.長按彈出刪除按鈕,點(diǎn)擊刪除

<div v-for="item in list" @touchstart.native="showDeleteButton(item.id)" @touchend.native="clearLoop(item.id)">
	內(nèi)容...
</div>
showDeleteButton(e) {
	clearTimeout(this.Loop); //再次清空定時(shí)器,防止重復(fù)注冊定時(shí)器
	this.Loop = setTimeout(function() {
		this.$dialog.confirm({   //這是個(gè)彈出框,用的ydui
			title: '溫馨提示',
			mes: '是否刪除此條消息',
			opts: () => {
				this.$dialog.loading.open('刪除中...');
				this.$http.post(this.$store.state.ip + '...', {
					id: e
				}, {
				    headers: {},
				}).then((response) => {
					this.$dialog.loading.close();
						this.$dialog.toast({
							mes: response.body.info,
							timeout: 1000
						});
						var data = this.rulist
						console.log(data)
						for(var i in data) {
							if(data[i].id == e) {
								data.splice(i, 1)
							}
						}
						console.log(data)
						this.rulist=data
						}).catch(function(response) {
 
						});
					}
		});
	}.bind(this), 1000);
},
clearLoop(e) {
	clearTimeout(this.Loop);
},

補(bǔ)充:下面看下Vue長按觸摸事件

開始觸摸:

@touchstart="touchClose()"

觸摸結(jié)束:

@touchend="touchOpen()"

使用示例:

到此這篇關(guān)于vue長按事件touch的文章就介紹到這了,更多相關(guān)vue長按事件touch內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論