New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

vue-page-swiper

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-page-swiper

vue3 & vue router 4 page swiper with navigation direction specific transitions


Version published
Maintainers
1
Created

vue-page-swiper

vue3 & vue router 4 page swiper with navigation direction specific transitions.

NPM Version

showcase

vue-page-swiper

usage

vue3 & vue router 4 are peer dependencies and must install along this lib.

// main.ts

import { createApp } from "vue"
import { createWebHashHistory } from "vue-router"

import { VuePageSwiper } from "vue-page-swiper"
import App from "./App.vue"
import { routes } from "./routes"

const app = createApp(App)

// app type: App<Element>
// options type: RouterOptions https://router.vuejs.org/api/interfaces/RouterOptions.html
VuePageSwiper(app, { routes, history: createWebHashHistory() }).mount("#app")
<!-- Vue page swiper container component-->
<template>
  <PageSwiper />
</template>
/* if you do not want horizontal scrollbar, apply following styles */

body,
html,
#app {
  height: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  border: 0;
  overflow-x: hidden;
}
// usePageSwiper usage 
import { usePageSwiper } from "vue-page-swiper"

// vue router 4 navigation methods
const { push, replace, back, forward } = usePageSwiper()

// navigation with direction specific transitions
// default transitions: 
// forward: swipe-right
// back: swipe-left
push("/page2")

// to type: https://router.vuejs.org/api/#RouteLocationRaw
// guide: https://router.vuejs.org/guide/essentials/navigation.html#Programmatic-Navigation
push({
  path: "/page2",
  // name: "page2",
  // query: { source: "dev" },
  // params: { username: "eduardo" }
  // hash: "#section5"
})

replace(
    "/page3",
    // optional once transition name
    "pageFade",
    // optional once transition mode
    "out-in"
    )

example

npm run dev

FAQs

Package last updated on 08 Aug 2023

Did you know?

Socket

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.

Install

Related posts