![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
vue-swipeable
Advanced tools
Vue-swipeable is a Vue directive that serves multiple purposes on mobile devices (uses touch events): * Swiping away a component (e.g: disposing a notification) * Partially swiping a component in order to reveal an action underneath * Pulling a component
Vue-swipeable is a Vue directive that serves multiple purposes on mobile devices (uses touch events):
The combination of the first two will give you a behaviour similar to the one you have with Android notifications (swipe partially to reveal some actions or swipe up to a certain threshold to remove the notification). The third option allows you implement, for example, a "pull to refresh" behaviour.
npm i vue-swipeable
or
yarn add vue-swipeable
Link(source) - Test on a mobile device or in chrome's mobile mode.
The directive relies on Touch events, you can't test it on desktop without switching to mobile mode.
Simple button with almost the same options as the ones you can find in the configuration section.
Example of a button that you can drag to the left or to the right to reveal some kind of action underneath.
A sorta replica of how the mobile notifications work:
You can drag to the bottom to toggle a refresh action (you can try to set an height greater than your viewport on the body in order to test your scrolling behaviour, you will see that the directive won't break the expected behaviour: it will ignore any touch event if you are not at the top of the page).
In your main.ts/main.js file
import { Swipeable } from 'vue-swipeable';
Vue.directive('swipeable', Swipeable);
Then in your desired .vue file:
<template>
<some-element-or-component v-swipeable="directiveOptions">
</some-element-or-component>
</template>
<script>
//...
data(): {
directiveOptions: {
type: 'horizontal',
swipeOut: true,
swipeOutBy: '200px',
swipeOutThreshold: '50px',
}
}
//...
</script>
Option | Description | Allowed values | Default |
---|---|---|---|
threshold | Minimum amount of pixels of movement before a swipe is registered | Number (pixels) | 5 |
backTime | Time in seconds taken by the element while returnint to its default position | Number (seconds) | .5 |
swipeTime | Time in seconds taken by element while moving to its swipedOut position | Number (seconds) | .5 |
type | Axix of the swipe | String ('horizontal' or 'vertical') | 'horizontal' |
allowedDirection | The direction to which the swipe should be limited on its axis | String ( 'top', 'bottom', 'left', 'right' or null) | null |
swipeOut | SwipeOut | Boolean | false |
swipeOutBy | How much should the element be swiped out | String ( 5, '5px' or '50%') | '50%' |
swipeOutThreshold | Pixels of movement required to trigger the swipe out logic | String ( 5, '5px' or '50%') | '25%' |
swipeAway | Can the element be completely swiped away | Boolean | false |
swipeAwayBy | How much should the element be swiped away | String ( 5, '5px' or '50%') | '1000%' |
swipeAwayThreshold | Pixels of movement required to trigger the swipe away logic | String ( 5, '5px' or '50%') | '55%' |
max | The max amount of pixel to component can be moved around on its axis (used only if swipeOut and swipeAway are false) | String ( 5, '5px', '50%' or null) | null |
debug | Should the directive print information related to its internal logic | Boolean | false |
In case of the "allowed value" String ( 5, '5px' or '50%')
5 or '5px' will be automatically interpreted as 5 pixels while '50%' will be interpreted as 50% of the size (width or height depending on type) of the element on which the directives is used on.
So in case of a type = 'horizontal'
on a button
that is 100px wide, a value of '50%' will be interpreted as '50px'.
Event | Description | Data |
---|---|---|
'swiped' | Triggered when the user has released the element after a movement greater than the swipeAwayThreshold | {direction: 'top'} ('top', 'bottom', 'left' or 'right') |
'swiped-away' | Triggered when the user has released the element after a movement greater than the swipeOutThreshold | {direction: 'top'} ('top', 'bottom', 'left' or 'right') |
FAQs
Vue-swipeable is a Vue directive that serves multiple purposes on mobile devices (uses touch events): * Swiping away a component (e.g: disposing a notification) * Partially swiping a component in order to reveal an action underneath * Pulling a component
We found that vue-swipeable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.