N
N
Nik_Set_72018-05-04 10:06:35
Multitouch and gestures
Nik_Set_7, 2018-05-04 10:06:35

How to make touch on vue.js?

The application requires using touch to bring up side menus from the main menu. I found a library based on hammer.js:
https://github.com/vuejs/vue-touch/tree/next
But it has some problems that it is not yet clear to solve:
- touch still works on the header, although the swipe event is hung on the entire block with the page
- it's not clear how to block some touches so that others work: for example, when hovering on block 1, block 2 should appear, and not a side menu
. Therefore, the question is: how is swipe and other touch fixed on vue.js 2 ?
UPD:
1. None of the libraries fit: they just didn't work. It may be worth spending more time on pure Hammer.js
2. The only library that came up was TouchSwipe 1.6
https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
This is a jQuery library that can be installed via npm and then connected via require
True, there are two problems that were immediately noticed:
- if there are several blocks on the page, for each of who need their own swipe (which goes in one direction). Here, you may have to come up with a system of statuses that will be stored in Vuex.
- Event bus. Perhaps when developing an application, you will use the event bus to transfer information from a component / mixin with a swipe to another component. In this case, it is worth considering that with each transition between pages, a new element will be added to the corresponding _events of your bus at the end.
Those. there may be such a situation that the user walked through the application, returned back and when he swiped, nothing opened for him. The reason is that the sidebar opened and closed several times . I
also noticed an interesting problem: if you save the work of the library in a mixin in which the swipe is initialized by class, then it is likely that it will work on one page and not on another. The only solution is to bind to id

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question