vue長押しイベントtouch

1183 ワード

1.touchイベント
以下は4つのtouchイベントです
touchstart://指をスクリーンに置くとトリガーされます
touchmove://指をスクリーン上でスライドさせるトリガ
touchend://指が画面を離れるとトリガーされます
touchcancel://システムがtouchイベントをキャンセルしたときにトリガーされますが、これは少ないようです
2.削除ボタンを長押しする、削除をクリックする
...
showDeleteButton(e) {
	clearTimeout(this.Loop); //       ,         
	this.Loop = setTimeout(function() {
		this.$dialog.confirm({   //      ,  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);
},