I want to build into an Ionic app using VueJS. And have problems with the “swipe function”.
When I swipe right or left, I want to call a function.
For testing I used the demo code from this page: Gestures - Ionic Documentation
The Chrome Dev Tools show me the following error message:
Uncaught (in promise) TypeError: Cannot read property ‘__zone_symbol__addEventListener’ of undefined at addEventListener
<script>
import { createGesture } from '@ionic/vue';
import { ref } from 'vue';
mounted() {
const pRef = ref();
const rectangleRef = ref();
const gesture = createGesture({
el: rectangleRef.value,
onMove: (detail) => { onMove(detail); }
})
gesture.enable();
const onMove = (detail) => {
const type = detail.type;
const currentX = detail.currentX;
const deltaX = detail.deltaX;
const velocityX = detail.velocityX;
pRef.value.innerHTML = "
<div>Type: ${type}</div>
<div>Current X: ${currentX}</div>
<div>Delta X: ${deltaX}</div>
<div>Velocity X: ${velocityX}</div>
"
}
}
Can someone tell me what I am doing wrong? Or is there a tutorial somewhere?
I use:
Ionic CLI : 6.13.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 5.6.5
@ionic/vue: ^5.4.0 => 5.6.5
7 posts - 2 participants