feat: 添加常用函数
This commit is contained in:
+39
@@ -2,6 +2,7 @@
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
||||
|
||||
onLaunch(() => {
|
||||
uni.showModal({ title: '提示', content: 'App Launch' })
|
||||
console.log('App Launch')
|
||||
})
|
||||
onShow(() => {
|
||||
@@ -72,4 +73,42 @@ image {
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
uni-modal {
|
||||
.uni-modal {
|
||||
@apply max-w-345 rounded-16;
|
||||
}
|
||||
|
||||
.uni-modal__hd {
|
||||
@apply p-0;
|
||||
}
|
||||
|
||||
.uni-modal__title {
|
||||
@apply p-16 text-left text-16 font-600;
|
||||
}
|
||||
|
||||
.uni-modal__bd {
|
||||
@apply mb-16 px-16 pt-0 text-left text-14 font-medium text-#666;
|
||||
}
|
||||
|
||||
.uni-modal__btn {
|
||||
@apply px-16 py-8 flex-none rounded-full shadow-none text-14;
|
||||
|
||||
&::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
&.uni-modal__btn_primary {
|
||||
@apply ml-8 bg-gray-200 !text-black;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-modal__ft {
|
||||
@apply justify-end p-16 leading-normal;
|
||||
|
||||
&::after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+28
-1
@@ -1,7 +1,7 @@
|
||||
import { pages, subPackages, tabBar } from '@/pages.json'
|
||||
import { isMp } from './platform'
|
||||
|
||||
const getLastPage = () => {
|
||||
export const getLastPage = () => {
|
||||
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
||||
// const lastPage = getCurrentPages().at(-1)
|
||||
// 上面那个在低版本安卓中打包回报错,所以改用下面这个【虽然我加了src/interceptions/prototype.ts,但依然报错】
|
||||
@@ -176,3 +176,30 @@ export const getEnvBaseUploadUrl = () => {
|
||||
|
||||
return baseUploadUrl
|
||||
}
|
||||
|
||||
export function mergeStep(wrapped: (...rest: any[]) => Promise<any>) {
|
||||
let _mergeStepRequestInstance: any = null
|
||||
return async function (...args) {
|
||||
if (this?._mergeStepRequestInstance ?? _mergeStepRequestInstance)
|
||||
return this?._mergeStepRequestInstance ?? _mergeStepRequestInstance
|
||||
if (this) {
|
||||
this._mergeStepRequestInstance = wrapped.apply(this, args)
|
||||
} else {
|
||||
_mergeStepRequestInstance = wrapped(...args)
|
||||
}
|
||||
if (
|
||||
Object.prototype.toString.call(
|
||||
this?._mergeStepRequestInstance ?? _mergeStepRequestInstance,
|
||||
) === '[object Promise]'
|
||||
) {
|
||||
;(this?._mergeStepRequestInstance ?? _mergeStepRequestInstance).finally(() => {
|
||||
if (this?._mergeStepRequestInstance) {
|
||||
this._mergeStepRequestInstance = null
|
||||
} else {
|
||||
_mergeStepRequestInstance = null
|
||||
}
|
||||
})
|
||||
}
|
||||
return _mergeStepRequestInstance
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitThis": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowJs": true,
|
||||
"sourceMap": true,
|
||||
|
||||
Reference in New Issue
Block a user