Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Rewrite v-touch as a component for Vue 2.x #62

@LinusBorg

Description

@LinusBorg

Problem

When Vue 2.0 came around, I attempted to update the v-touch directive to Vue 2.0's new API.

But we never published it so far, because I wasn't successful to keep the all features due to the API changes foir custom directives in Vue 2.0

Solution

I decided to rewrite it all as a component. API will look like this:

<v-touch
  tag="div" <!-- default. Use to change the root element rendered by the component -->
  v-on:pan="method"
  v-bind:pan-options="{ ... }"
  
  <!-- short syntax; -->
  @swipe="method"
  :swipe-options="{ ... }"
>
 <p>Slot Content goes here</p>
</v-touch>

Breaking Change & Migrating

Of course, this means we will have a complete breaking change with the version for Vue 1.0.

But I think the upgrade path is pretty simple:

<!-- 1.0 -->
<section v-touch:swipe="method" v-touch-options:swipe="{ ....}"
  <p>Swipe me!</p>
</section>
<!-- 2.0 -->
<v-touch tag="section" @swipe="method" :swipe-options="{ ....}"
  <p>Swipe me!</p>
</v-touch>

I'm already 90% done with the working prototype, And will hopefully find time this weekend to do the cleanup.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions