From cac78b14e06f7d52a0eb79c0fb727cdc83fa8508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E7=A8=8B=E8=AE=AD?= Date: Sat, 3 Jun 2023 21:06:44 +0800 Subject: [PATCH] Version_0.1.9 --- esm/index.js | 2 +- esm/url.js | 6 ++++++ package.json | 4 ++-- src/index.ts | 2 +- src/url.ts | 7 +++++++ types/index.d.ts | 2 +- types/url.d.ts | 1 + yarn.lock | 8 ++++---- 8 files changed, 23 insertions(+), 9 deletions(-) diff --git a/esm/index.js b/esm/index.js index 58bdfca..54d01cf 100644 --- a/esm/index.js +++ b/esm/index.js @@ -14,6 +14,6 @@ export { formatNumber } from 'galanga'; export { afterTime } from 'galanga'; //导出自己的子模块 export { localCookie } from './cookie'; -export { url } from './url'; +export { url, getPreURL } from './url'; export { checkDeviceType, clipboard } from './device'; export { notificationPermission, clipboardPermission, locationPermission } from './permission'; diff --git a/esm/url.js b/esm/url.js index ec926de..31ef7dc 100644 --- a/esm/url.js +++ b/esm/url.js @@ -26,3 +26,9 @@ export const url = { currentRoute.$page.options[key] = value; } }; +//获取上一页的url +export function getPreURL() { + const uniRouter = getCurrentPages(); + const prevRoute = uniRouter[uniRouter.length - 2]; + return '/' + prevRoute.route; +} diff --git a/package.json b/package.json index c8ca9ae..f86462b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@uni-helper/galanga", - "version": "0.1.8-test1", + "version": "0.1.9", "description": "JS common function library(UNI-APP version of Galanga)", "main": "esm/index.js", "jsnext:main": "esm/index.js", @@ -70,6 +70,6 @@ "typescript": "^5.0.4" }, "dependencies": { - "galanga": "^0.1.8" + "galanga": "^0.1.9" } } diff --git a/src/index.ts b/src/index.ts index f093e73..c058e5a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,6 +17,6 @@ export { afterTime } from 'galanga'; //导出自己的子模块 export { localCookie } from './cookie'; -export { url } from './url'; +export { url, getPreURL } from './url'; export { checkDeviceType, clipboard } from './device'; export { notificationPermission, clipboardPermission, locationPermission } from './permission'; \ No newline at end of file diff --git a/src/url.ts b/src/url.ts index 7b8400d..1596803 100644 --- a/src/url.ts +++ b/src/url.ts @@ -27,4 +27,11 @@ export const url = { const currentRoute = uniRouter[uniRouter.length - 1]; currentRoute.$page.options[key] = value; } +} + +//获取上一页的url +export function getPreURL() { + const uniRouter = getCurrentPages(); + const prevRoute = uniRouter[uniRouter.length - 2]; + return '/' + prevRoute.route; } \ No newline at end of file diff --git a/types/index.d.ts b/types/index.d.ts index 2ec6541..0923bce 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -9,6 +9,6 @@ export { filterUniqueByProperty } from 'galanga'; export { formatNumber } from 'galanga'; export { afterTime } from 'galanga'; export { localCookie } from './cookie'; -export { url } from './url'; +export { url, getPreURL } from './url'; export { checkDeviceType, clipboard } from './device'; export { notificationPermission, clipboardPermission, locationPermission } from './permission'; diff --git a/types/url.d.ts b/types/url.d.ts index 3521432..e719d24 100644 --- a/types/url.d.ts +++ b/types/url.d.ts @@ -6,3 +6,4 @@ export declare const url: { setPath: (value: string) => void; setQuery: (key: string, value: string) => void; }; +export declare function getPreURL(): string; diff --git a/yarn.lock b/yarn.lock index fcf871f..fb94684 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1600,10 +1600,10 @@ function-bind@^1.1.1: resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -galanga@^0.1.8: - version "0.1.8" - resolved "https://registry.yarnpkg.com/galanga/-/galanga-0.1.8.tgz#a4668b9f3303daf1233e0a8305ce243078804bbf" - integrity sha512-miv0pAFcoS8I09wDhIM16g7jL9l5uxlyu6ksmKClTfIJpr0q/E6rhuyWguV6wGYoSVkVKRaFPuBhCnLZL6ARBw== +galanga@^0.1.9: + version "0.1.9" + resolved "https://registry.npmjs.org/galanga/-/galanga-0.1.9.tgz#10170983feb5e492f8dda2280095f4c1021a7344" + integrity sha512-OXZH80m7x1Q70sJrtv1jyDXQFlHSCk1Ws1j96WEYbuBFNRRc9zzUsq4hqz34IvRhxDnDJzd66WuDuMN/p86Eeg== gensync@^1.0.0-beta.2: version "1.0.0-beta.2"