uniapp-router-next
Advanced tools
@@ -1118,3 +1118,3 @@ 'use strict'; | ||
| initMixins(app, router); | ||
| console.log(`%c uni-router %c v${"1.1.9"} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;"); | ||
| console.log(`%c uni-router %c v${"1.2.0"} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;"); | ||
| return mountApp(...args); | ||
@@ -1121,0 +1121,0 @@ }; |
+1
-1
@@ -1118,3 +1118,3 @@ 'use strict'; | ||
| initMixins(app, router); | ||
| console.log(`%c uni-router %c v${"1.1.9"} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;"); | ||
| console.log(`%c uni-router %c v${"1.2.0"} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;"); | ||
| return mountApp(...args); | ||
@@ -1121,0 +1121,0 @@ }; |
+1
-1
@@ -1116,3 +1116,3 @@ import { inject, warn as warn$1, shallowRef, computed, unref, reactive } from 'vue'; | ||
| initMixins(app, router); | ||
| console.log(`%c uni-router %c v${"1.1.9"} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;"); | ||
| console.log(`%c uni-router %c v${"1.2.0"} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;"); | ||
| return mountApp(...args); | ||
@@ -1119,0 +1119,0 @@ }; |
+1
-1
| { | ||
| "name": "uniapp-router-next", | ||
| "version": "1.1.9", | ||
| "version": "1.2.0", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "exports": { |
+104
-3
@@ -9,3 +9,3 @@ # uniapp-router-next | ||
| $ npm install uniapp-router-next | ||
| $ npm install unplugin-uni-router -D | ||
| $ npm install unplugin-uni-router -D | ||
| ``` | ||
@@ -29,3 +29,13 @@ | ||
| const router = createRouter({ | ||
| routes, | ||
| routes: [ | ||
| ...routes, | ||
| // 通配符,一般用于匹配不到路径跳转404页面 | ||
| { | ||
| path: '*', | ||
| redirect: () => { | ||
| // 可返回{ name: '404' },{ path: '/pages/404/404' }, '/pages/404/404' | ||
| return { name: '404' } | ||
| } | ||
| } | ||
| ], | ||
| //@ts-ignore | ||
@@ -72,2 +82,3 @@ platform: process.env.UNI_PLATFORM, | ||
| router.switchTab.. | ||
| router.navigateBack... | ||
| ``` | ||
@@ -81,2 +92,10 @@ | ||
| ``` | ||
| #### 组件props | ||
| ```js | ||
| // 跳转类型 | ||
| navType = 'navigate' | 'redirect' | 'reLaunch' | 'switchTab' | 'navigateBack' | ||
| // navType = navigateBack时,可传回退页面层数 | ||
| delta //默认值为1 | ||
| ``` | ||
| ### 路由信息 | ||
@@ -109,2 +128,84 @@ ```typescript | ||
| }) | ||
| ``` | ||
| ``` | ||
| ### 实验性功能 | ||
| #### App.vue 模板替换 | ||
| - 开启该功能 (unplugin-uni-router需更新到1.2.0版本以上) | ||
| ```ts | ||
| import { defineConfig } from 'vite' | ||
| import uni from '@dcloudio/vite-plugin-uni' | ||
| import uniRouter from 'unplugin-uni-router/vite' | ||
| // https://vitejs.dev/config/ | ||
| export default defineConfig({ | ||
| plugins: [uni(),uniRouter({ | ||
| replaceAppToPages: true //开启模板替换功能 | ||
| })] | ||
| }) | ||
| ``` | ||
| - 在App.vue中写入公共模板 | ||
| ```html | ||
| <template> | ||
| <view>header</view> | ||
| <outlet /> | ||
| <view>footer</view> | ||
| </template> | ||
| <script setup lang="ts"> | ||
| import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; | ||
| onLaunch(() => { | ||
| console.log("App Launch"); | ||
| }); | ||
| onShow(() => { | ||
| console.log("App Show"); | ||
| }); | ||
| onHide(() => { | ||
| console.log("App Hide"); | ||
| }); | ||
| </script> | ||
| <style></style> | ||
| ``` | ||
| - 最终会替换所有在pages.json中注册的页面 | ||
| ```html | ||
| // page.vue | ||
| <template> | ||
| <view>page</view> | ||
| </template> | ||
| ``` | ||
| - 替换结果 | ||
| ```html | ||
| // page.vue | ||
| <template> | ||
| <view>header</view> | ||
| <view>page</view> | ||
| <view>footer</view> | ||
| </template> | ||
| ``` | ||
| - 取消某一页面的替换 | ||
| 在pages.json中添加skipReplace | ||
| ```json | ||
| { | ||
| "pages": [ | ||
| { | ||
| "path": "pages/index/index", | ||
| "name": "index", | ||
| "aliasPath": "/", | ||
| "meta": { | ||
| }, | ||
| "skipReplace": true | ||
| }] | ||
| } | ||
| ``` | ||
| #### 注意 | ||
| App.vue 模板替换会影响页面的布局,请谨慎使用,而且替换只能替换template中的静态内容,无法替换template中标签绑定的数据 | ||
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
140730
1.51%207
97.14%