uni-use-router
v0.0.7
Published
UniApp 路由跳转补充,与 Vue Router 语法靠近
Downloads
22
Maintainers
Readme
uni-use-router
UniApp 路由跳转补充,与 Vue Router 语法靠近
🚀 Install
pnpm add uni-use-router --save-dev
⚡️ Usage
<script setup lang="ts">
import { useRouter } from 'uni-use-router'
const router = useRouter({
webview: '/pages/webview'
})
</script>
<template>
<view class="box">
<button @click="router.push('/pages/test/test?a=1&b=2')">
Go Test
</button>
<button
@click="router.push({
url: '/pages/test/test',
query: {
a: 1,
b: '2',
c: null,
},
})"
>
Go Test
</button>
<button @click="router.replace('/pages/test/test')">
Go Replace
</button>
<button @click="router.push('https://www.baidu.com')">
Go H5
</button>
</view>
</template>
<style scoped>
.box {
display: flex;
flex-direction: column;
gap: 10rpx;
}
</style>
License
MIT License © 2024-PRESENT Ares Chang