提交 35a3c076 编写于 作者: fxy060608's avatar fxy060608

wip(app): uni-app-vite

上级 2c89f5a1
...@@ -24,16 +24,16 @@ declare namespace UniApp { ...@@ -24,16 +24,16 @@ declare namespace UniApp {
interface UniConfig { interface UniConfig {
ready?: boolean ready?: boolean
router: { router?: {
strict: boolean strict: boolean
base: string base: string
} }
nvue: { nvue?: {
'flex-direction': 'column' | 'row' 'flex-direction': 'column' | 'row'
} }
globalStyle: { globalStyle: {
navigationBar: PageNavigationBar navigationBar: PageNavigationBar
refreshOptions?: PageRefreshOptions pullToRefresh?: PageRefreshOptions
maxWidth?: number maxWidth?: number
rpxCalcMaxDeviceWidth?: number rpxCalcMaxDeviceWidth?: number
rpxCalcBaseDeviceWidth?: number rpxCalcBaseDeviceWidth?: number
...@@ -125,12 +125,12 @@ declare namespace UniApp { ...@@ -125,12 +125,12 @@ declare namespace UniApp {
coverage?: string coverage?: string
} }
interface PageRefreshOptions { interface PageRefreshOptions {
support: boolean support?: boolean
color: string color?: string
style: 'circle' | string style?: 'circle' | string
height: number height?: number
range: number range?: number
offset: number offset?: number
} }
interface PagesJsonPagePlatformStyle { interface PagesJsonPagePlatformStyle {
...@@ -149,7 +149,7 @@ declare namespace UniApp { ...@@ -149,7 +149,7 @@ declare namespace UniApp {
disableScroll?: boolean disableScroll?: boolean
enablePullDownRefresh?: boolean enablePullDownRefresh?: boolean
navigationBar: PageNavigationBar navigationBar: PageNavigationBar
refreshOptions?: PageRefreshOptions pullToRefresh?: PageRefreshOptions
onReachBottomDistance?: number onReachBottomDistance?: number
pageOrientation?: 'auto' | 'portrait' | 'landscape' pageOrientation?: 'auto' | 'portrait' | 'landscape'
backgroundColor?: string backgroundColor?: string
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`webviewStyle basic 1`] = `
Object {
"bounce": "vertical",
"titleNView": Object {
"autoBackButton": true,
},
}
`;
import { parseWebviewStyle } from '../src/service/framework/page/webview/style'
function initDefaultUniConfig() {
return JSON.parse(
JSON.stringify({
globalStyle: {
navigationBar: {},
},
})
)
}
beforeAll(() => {
global.__uniConfig = initDefaultUniConfig()
})
const defaultPath = '/pages/index/index'
const defaultRoute = 'pages/index/index'
describe('webviewStyle', () => {
test('basic', () => {
expect(
parseWebviewStyle(1, defaultPath, {
path: defaultPath,
meta: {
route: defaultRoute,
navigationBar: {},
},
})
).toMatchSnapshot()
})
})
...@@ -112,7 +112,32 @@ var serviceContext = (function () { ...@@ -112,7 +112,32 @@ var serviceContext = (function () {
const DATA_RE = /^data:.*,.*/; const DATA_RE = /^data:.*,.*/;
const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'; const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE';
const PAGE_META_KEYS = ['navigationBar', 'refreshOptions']; function hasRpx(str) {
return str.indexOf('rpx') !== -1 || str.indexOf('upx') !== -1;
}
function rpx2px(str, replace = false) {
if (replace) {
return rpx2pxWithReplace(str);
}
if (typeof str === 'string') {
const res = parseInt(str) || 0;
if (hasRpx(str)) {
return uni.upx2px(res);
}
return res;
}
return str;
}
function rpx2pxWithReplace(str) {
if (!hasRpx(str)) {
return str;
}
return str.replace(/(\d+(\.\d+)?)[ru]px/g, (_a, b) => {
return uni.upx2px(parseFloat(b)) + 'px';
});
}
const PAGE_META_KEYS = ['navigationBar', 'pullToRefresh'];
function initGlobalStyle() { function initGlobalStyle() {
return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {})); return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {}));
} }
...@@ -123,6 +148,18 @@ var serviceContext = (function () { ...@@ -123,6 +148,18 @@ var serviceContext = (function () {
res[name] = extend({}, globalStyle[name], pageMeta[name]); res[name] = extend({}, globalStyle[name], pageMeta[name]);
}); });
return res; return res;
}
function normalizePullToRefreshRpx(pullToRefresh) {
if (pullToRefresh.offset) {
pullToRefresh.offset = rpx2px(pullToRefresh.offset);
}
if (pullToRefresh.height) {
pullToRefresh.height = rpx2px(pullToRefresh.height);
}
if (pullToRefresh.range) {
pullToRefresh.range = rpx2px(pullToRefresh.range);
}
return pullToRefresh;
} }
function getRealRoute(fromRoute, toRoute) { function getRealRoute(fromRoute, toRoute) {
...@@ -585,9 +622,9 @@ var serviceContext = (function () { ...@@ -585,9 +622,9 @@ var serviceContext = (function () {
if (!routeMeta.enablePullDownRefresh) { if (!routeMeta.enablePullDownRefresh) {
return; return;
} }
webviewStyle.pullToRefresh = extend({}, plus.os.name === 'Android' webviewStyle.pullToRefresh = normalizePullToRefreshRpx(extend({}, plus.os.name === 'Android'
? defaultAndroidPullToRefresh ? defaultAndroidPullToRefresh
: defaultPullToRefresh, routeMeta.refreshOptions); : defaultPullToRefresh, routeMeta.pullToRefresh));
} }
const defaultAndroidPullToRefresh = { support: true, style: 'circle' }; const defaultAndroidPullToRefresh = { support: true, style: 'circle' };
const defaultPullToRefresh = { const defaultPullToRefresh = {
...@@ -693,7 +730,7 @@ var serviceContext = (function () { ...@@ -693,7 +730,7 @@ var serviceContext = (function () {
'disableScroll', 'disableScroll',
'enablePullDownRefresh', 'enablePullDownRefresh',
'navigationBar', 'navigationBar',
'refreshOptions', 'pullToRefresh',
'onReachBottomDistance', 'onReachBottomDistance',
'pageOrientation', 'pageOrientation',
'backgroundColor', 'backgroundColor',
......
...@@ -48,7 +48,7 @@ const WEBVIEW_STYLE_BLACKLIST = [ ...@@ -48,7 +48,7 @@ const WEBVIEW_STYLE_BLACKLIST = [
'disableScroll', 'disableScroll',
'enablePullDownRefresh', 'enablePullDownRefresh',
'navigationBar', 'navigationBar',
'refreshOptions', 'pullToRefresh',
'onReachBottomDistance', 'onReachBottomDistance',
'pageOrientation', 'pageOrientation',
'backgroundColor', 'backgroundColor',
......
import { normalizePullToRefreshRpx } from '@dcloudio/uni-core'
import { extend } from '@vue/shared' import { extend } from '@vue/shared'
export function initPullToRefresh( export function initPullToRefresh(
...@@ -7,12 +8,14 @@ export function initPullToRefresh( ...@@ -7,12 +8,14 @@ export function initPullToRefresh(
if (!routeMeta.enablePullDownRefresh) { if (!routeMeta.enablePullDownRefresh) {
return return
} }
webviewStyle.pullToRefresh = extend( webviewStyle.pullToRefresh = normalizePullToRefreshRpx(
{}, extend(
plus.os.name === 'Android' {},
? defaultAndroidPullToRefresh plus.os.name === 'Android'
: defaultPullToRefresh, ? defaultAndroidPullToRefresh
routeMeta.refreshOptions : defaultPullToRefresh,
routeMeta.pullToRefresh
)
) as unknown as PlusWebviewWebviewPullToRefreshStyles ) as unknown as PlusWebviewWebviewPullToRefreshStyles
} }
......
...@@ -11,7 +11,7 @@ function uniCopyPlugin() { ...@@ -11,7 +11,7 @@ function uniCopyPlugin() {
return uni_cli_shared_1.uniViteCopyPlugin({ return uni_cli_shared_1.uniViteCopyPlugin({
targets: [ targets: [
{ {
src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/')), src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*')),
dest: process.env.UNI_OUTPUT_DIR, dest: process.env.UNI_OUTPUT_DIR,
}, },
{ {
......
...@@ -7,7 +7,7 @@ export function uniCopyPlugin() { ...@@ -7,7 +7,7 @@ export function uniCopyPlugin() {
return uniViteCopyPlugin({ return uniViteCopyPlugin({
targets: [ targets: [
{ {
src: slash(path.resolve(__dirname, '../../lib/template/')), src: slash(path.resolve(__dirname, '../../lib/template/*')),
dest: process.env.UNI_OUTPUT_DIR, dest: process.env.UNI_OUTPUT_DIR,
}, },
{ {
......
...@@ -106,7 +106,7 @@ function normalizePageStyle( ...@@ -106,7 +106,7 @@ function normalizePageStyle(
pageStyle.navigationBar = normalizeNavigationBar(pageStyle) pageStyle.navigationBar = normalizeNavigationBar(pageStyle)
if (isEnablePullDownRefresh(pageStyle)) { if (isEnablePullDownRefresh(pageStyle)) {
pageStyle.enablePullDownRefresh = true pageStyle.enablePullDownRefresh = true
pageStyle.refreshOptions = normalizePullToRefresh(pageStyle) pageStyle.pullToRefresh = normalizePullToRefresh(pageStyle)
} }
} }
return removePlatformStyle(pageStyle) return removePlatformStyle(pageStyle)
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`page mergePageMeta 1`] = `
Object {
"id": 1,
"navigationBar": Object {
"titleText": "uni-app",
},
"pullToRefresh": Object {},
"route": "",
}
`;
exports[`page mergePageMeta 2`] = `
Object {
"enablePullDownRefresh": true,
"id": 1,
"navigationBar": Object {
"titleColor": "#000000",
"titleText": "hello",
},
"pullToRefresh": Object {},
"route": "",
}
`;
exports[`page mergePageMeta 3`] = `
Object {
"enablePullDownRefresh": true,
"id": 1,
"navigationBar": Object {
"titleColor": "#000000",
"titleText": "uni-app",
},
"pullToRefresh": Object {
"offset": 100,
},
"route": "",
}
`;
import { mergePageMeta } from '../../src/helpers/page'
function initDefaultUniConfig() {
return JSON.parse(
JSON.stringify({
globalStyle: {
navigationBar: {},
},
})
)
}
describe('page', () => {
test('mergePageMeta', () => {
global.__uniConfig = initDefaultUniConfig()
global.__uniConfig.globalStyle.navigationBar.titleText = 'uni-app'
expect(
mergePageMeta(1, {
route: '',
navigationBar: {},
})
).toMatchSnapshot()
expect(
mergePageMeta(1, {
route: '',
navigationBar: { titleText: 'hello', titleColor: '#000000' },
enablePullDownRefresh: true,
})
).toMatchSnapshot()
expect(
mergePageMeta(1, {
route: '',
navigationBar: { titleColor: '#000000' },
enablePullDownRefresh: true,
pullToRefresh: {
offset: 100,
},
})
).toMatchSnapshot()
})
})
import { extend } from '@vue/shared' import { extend } from '@vue/shared'
import { ComponentPublicInstance, getCurrentInstance } from 'vue' import { ComponentPublicInstance, getCurrentInstance } from 'vue'
import { rpx2px } from './util'
export function useCurrentPageId() { export function useCurrentPageId() {
return getCurrentInstance()!.root.proxy!.$page.id return getCurrentInstance()!.root.proxy!.$page.id
...@@ -15,7 +16,7 @@ export function getPageIdByVm(vm: ComponentPublicInstance) { ...@@ -15,7 +16,7 @@ export function getPageIdByVm(vm: ComponentPublicInstance) {
} }
} }
const PAGE_META_KEYS = ['navigationBar', 'refreshOptions'] as const const PAGE_META_KEYS = ['navigationBar', 'pullToRefresh'] as const
function initGlobalStyle() { function initGlobalStyle() {
return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {})) return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {}))
...@@ -32,3 +33,18 @@ export function mergePageMeta( ...@@ -32,3 +33,18 @@ export function mergePageMeta(
}) })
return res return res
} }
export function normalizePullToRefreshRpx(
pullToRefresh: UniApp.PageRefreshOptions
) {
if (pullToRefresh.offset) {
pullToRefresh.offset = rpx2px(pullToRefresh.offset)
}
if (pullToRefresh.height) {
pullToRefresh.height = rpx2px(pullToRefresh.height)
}
if (pullToRefresh.range) {
pullToRefresh.range = rpx2px(pullToRefresh.range)
}
return pullToRefresh
}
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import { useI18n } from './useI18n' import { useI18n } from './useI18n'
const i18n = /*#__PURE__*/ useI18n()
function normalizeMessages( function normalizeMessages(
namespace: string, namespace: string,
messages: Record<string, string> messages: Record<string, string>
...@@ -22,19 +22,19 @@ function normalizeMessages( ...@@ -22,19 +22,19 @@ function normalizeMessages(
export const initI18nAppMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nAppMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.app.' const name = 'uni.app.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { quit: 'Press back button again to exit' }) normalizeMessages(name, { quit: 'Press back button again to exit' })
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { quit: 'Pulse otra vez para salir' }) normalizeMessages(name, { quit: 'Pulse otra vez para salir' })
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
quit: "Appuyez à nouveau pour quitter l'application", quit: "Appuyez à nouveau pour quitter l'application",
...@@ -42,13 +42,13 @@ export const initI18nAppMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -42,13 +42,13 @@ export const initI18nAppMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { quit: '再按一次退出应用' }) normalizeMessages(name, { quit: '再按一次退出应用' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { quit: '再按一次退出應用' }) normalizeMessages(name, { quit: '再按一次退出應用' })
) )
...@@ -57,7 +57,7 @@ export const initI18nAppMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -57,7 +57,7 @@ export const initI18nAppMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.async.' const name = 'uni.async.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
error: 'The connection timed out, click the screen to try again.', error: 'The connection timed out, click the screen to try again.',
...@@ -65,7 +65,7 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -65,7 +65,7 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
error: error:
...@@ -74,7 +74,7 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -74,7 +74,7 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
error: "La connexion a expiré, cliquez sur l'écran pour réessayer.", error: "La connexion a expiré, cliquez sur l'écran pour réessayer.",
...@@ -82,13 +82,13 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -82,13 +82,13 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { error: '连接服务器超时,点击屏幕重试' }) normalizeMessages(name, { error: '连接服务器超时,点击屏幕重试' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { error: '連接服務器超時,點擊屏幕重試' }) normalizeMessages(name, { error: '連接服務器超時,點擊屏幕重試' })
) )
...@@ -97,25 +97,25 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -97,25 +97,25 @@ export const initI18nAsyncMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nShowActionSheetMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nShowActionSheetMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.showActionSheet.' const name = 'uni.showActionSheet.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { cancel: 'Cancel' })) useI18n().add(LOCALE_EN, normalizeMessages(name, { cancel: 'Cancel' }))
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { cancel: 'Cancelar' })) useI18n().add(LOCALE_ES, normalizeMessages(name, { cancel: 'Cancelar' }))
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { cancel: 'Annuler' })) useI18n().add(LOCALE_FR, normalizeMessages(name, { cancel: 'Annuler' }))
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { cancel: '取消' })) useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, { cancel: '取消' }))
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { cancel: '取消' })) useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, { cancel: '取消' }))
} }
}) })
export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.showToast.' const name = 'uni.showToast.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: 'Please note showToast must be paired with hideToast', unpaired: 'Please note showToast must be paired with hideToast',
...@@ -123,7 +123,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -123,7 +123,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: unpaired:
...@@ -132,7 +132,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -132,7 +132,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: 'Veuillez noter que showToast doit être associé à hideToast', unpaired: 'Veuillez noter que showToast doit être associé à hideToast',
...@@ -140,7 +140,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -140,7 +140,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: '请注意 showToast 与 hideToast 必须配对使用', unpaired: '请注意 showToast 与 hideToast 必须配对使用',
...@@ -148,7 +148,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -148,7 +148,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: '請注意 showToast 與 hideToast 必須配對使用', unpaired: '請注意 showToast 與 hideToast 必須配對使用',
...@@ -159,7 +159,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -159,7 +159,7 @@ export const initI18nShowToastMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.showLoading.' const name = 'uni.showLoading.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: 'Please note showLoading must be paired with hideLoading', unpaired: 'Please note showLoading must be paired with hideLoading',
...@@ -167,7 +167,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -167,7 +167,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: unpaired:
...@@ -176,7 +176,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -176,7 +176,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: unpaired:
...@@ -185,7 +185,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -185,7 +185,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: '请注意 showLoading 与 hideLoading 必须配对使用', unpaired: '请注意 showLoading 与 hideLoading 必须配对使用',
...@@ -193,7 +193,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -193,7 +193,7 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { normalizeMessages(name, {
unpaired: '請注意 showLoading 與 hideLoading 必須配對使用', unpaired: '請注意 showLoading 與 hideLoading 必須配對使用',
...@@ -204,31 +204,31 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -204,31 +204,31 @@ export const initI18nShowLoadingMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nShowModalMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nShowModalMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.showModal.' const name = 'uni.showModal.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { cancel: 'Cancel', confirm: 'OK' }) normalizeMessages(name, { cancel: 'Cancel', confirm: 'OK' })
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { cancel: 'Cancelar', confirm: 'OK' }) normalizeMessages(name, { cancel: 'Cancelar', confirm: 'OK' })
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { cancel: 'Annuler', confirm: 'OK' }) normalizeMessages(name, { cancel: 'Annuler', confirm: 'OK' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { cancel: '取消', confirm: '确定' }) normalizeMessages(name, { cancel: '取消', confirm: '确定' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { cancel: '取消', confirm: '確定' }) normalizeMessages(name, { cancel: '取消', confirm: '確定' })
) )
...@@ -237,7 +237,7 @@ export const initI18nShowModalMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -237,7 +237,7 @@ export const initI18nShowModalMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.chooseImage.' const name = 'uni.chooseImage.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Cancel', cancel: 'Cancel',
...@@ -247,7 +247,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -247,7 +247,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Cancelar', cancel: 'Cancelar',
...@@ -257,7 +257,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -257,7 +257,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Annuler', cancel: 'Annuler',
...@@ -267,7 +267,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -267,7 +267,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { normalizeMessages(name, {
cancel: '取消', cancel: '取消',
...@@ -277,7 +277,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -277,7 +277,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { normalizeMessages(name, {
cancel: '取消', cancel: '取消',
...@@ -290,7 +290,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -290,7 +290,7 @@ export const initI18nChooseImageMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.chooseVideo.' const name = 'uni.chooseVideo.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Cancel', cancel: 'Cancel',
...@@ -300,7 +300,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -300,7 +300,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Cancelar', cancel: 'Cancelar',
...@@ -310,7 +310,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -310,7 +310,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Annuler', cancel: 'Annuler',
...@@ -320,7 +320,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -320,7 +320,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { normalizeMessages(name, {
cancel: '取消', cancel: '取消',
...@@ -330,7 +330,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -330,7 +330,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { normalizeMessages(name, {
cancel: '取消', cancel: '取消',
...@@ -343,7 +343,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -343,7 +343,7 @@ export const initI18nChooseVideoMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.previewImage.' const name = 'uni.previewImage.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Cancel', cancel: 'Cancel',
...@@ -354,7 +354,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -354,7 +354,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Cancelar', cancel: 'Cancelar',
...@@ -365,7 +365,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -365,7 +365,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
cancel: 'Annuler', cancel: 'Annuler',
...@@ -376,7 +376,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -376,7 +376,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { normalizeMessages(name, {
cancel: '取消', cancel: '取消',
...@@ -387,7 +387,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -387,7 +387,7 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { normalizeMessages(name, {
cancel: '取消', cancel: '取消',
...@@ -401,28 +401,40 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -401,28 +401,40 @@ export const initI18nPreviewImageMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nSetClipboardDataMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nSetClipboardDataMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.setClipboardData.' const name = 'uni.setClipboardData.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { success: 'Content copied' })) useI18n().add(
LOCALE_EN,
normalizeMessages(name, { success: 'Content copied' })
)
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { success: 'Contenido copiado' }) normalizeMessages(name, { success: 'Contenido copiado' })
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { success: 'Contenu copié' })) useI18n().add(
LOCALE_FR,
normalizeMessages(name, { success: 'Contenu copié' })
)
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { success: '内容已复制' })) useI18n().add(
LOCALE_ZH_HANS,
normalizeMessages(name, { success: '内容已复制' })
)
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { success: '內容已復制' })) useI18n().add(
LOCALE_ZH_HANT,
normalizeMessages(name, { success: '內容已復制' })
)
} }
}) })
export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.scanCode.' const name = 'uni.scanCode.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
title: 'Scan code', title: 'Scan code',
...@@ -434,7 +446,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -434,7 +446,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
title: 'Código de escaneo', title: 'Código de escaneo',
...@@ -446,7 +458,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -446,7 +458,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
title: 'Code d’analyse', title: 'Code d’analyse',
...@@ -458,7 +470,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -458,7 +470,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { normalizeMessages(name, {
title: '扫码', title: '扫码',
...@@ -470,7 +482,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -470,7 +482,7 @@ export const initI18nScanCodeMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { normalizeMessages(name, {
title: '掃碼', title: '掃碼',
...@@ -486,13 +498,13 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once( ...@@ -486,13 +498,13 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once(
() => { () => {
const name = 'uni.startSoterAuthentication.' const name = 'uni.startSoterAuthentication.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { authContent: 'Fingerprint recognition' }) normalizeMessages(name, { authContent: 'Fingerprint recognition' })
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
authContent: 'Reconocimiento de huellas dactilares', authContent: 'Reconocimiento de huellas dactilares',
...@@ -500,7 +512,7 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once( ...@@ -500,7 +512,7 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once(
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
authContent: "Reconnaissance de l'empreinte digitale", authContent: "Reconnaissance de l'empreinte digitale",
...@@ -508,13 +520,13 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once( ...@@ -508,13 +520,13 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once(
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { authContent: '指纹识别中...' }) normalizeMessages(name, { authContent: '指纹识别中...' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { authContent: '指紋識別中...' }) normalizeMessages(name, { authContent: '指紋識別中...' })
) )
...@@ -524,31 +536,31 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once( ...@@ -524,31 +536,31 @@ export const initI18nStartSoterAuthenticationMsgsOnce = /*#__PURE__*/ once(
export const initI18nPickerMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nPickerMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.picker.' const name = 'uni.picker.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { done: 'Done', cancel: 'Cancel' }) normalizeMessages(name, { done: 'Done', cancel: 'Cancel' })
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { done: 'OK', cancel: 'Cancelar' }) normalizeMessages(name, { done: 'OK', cancel: 'Cancelar' })
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { done: 'OK', cancel: 'Annuler' }) normalizeMessages(name, { done: 'OK', cancel: 'Annuler' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { done: '完成', cancel: '取消' }) normalizeMessages(name, { done: '完成', cancel: '取消' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { done: '完成', cancel: '取消' }) normalizeMessages(name, { done: '完成', cancel: '取消' })
) )
...@@ -557,31 +569,31 @@ export const initI18nPickerMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -557,31 +569,31 @@ export const initI18nPickerMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nVideoMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nVideoMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.video.' const name = 'uni.video.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { danmu: 'Danmu', volume: 'Volume' }) normalizeMessages(name, { danmu: 'Danmu', volume: 'Volume' })
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { danmu: 'Danmu', volume: 'Volumen' }) normalizeMessages(name, { danmu: 'Danmu', volume: 'Volumen' })
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { danmu: 'Danmu', volume: 'Le Volume' }) normalizeMessages(name, { danmu: 'Danmu', volume: 'Le Volume' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { danmu: '弹幕', volume: '音量' }) normalizeMessages(name, { danmu: '弹幕', volume: '音量' })
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { danmu: '彈幕', volume: '音量' }) normalizeMessages(name, { danmu: '彈幕', volume: '音量' })
) )
...@@ -590,7 +602,7 @@ export const initI18nVideoMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -590,7 +602,7 @@ export const initI18nVideoMsgsOnce = /*#__PURE__*/ once(() => {
export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => { export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => {
const name = 'uni.button.' const name = 'uni.button.'
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add( useI18n().add(
LOCALE_EN, LOCALE_EN,
normalizeMessages(name, { normalizeMessages(name, {
'feedback.title': 'feedback', 'feedback.title': 'feedback',
...@@ -599,7 +611,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -599,7 +611,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add( useI18n().add(
LOCALE_ES, LOCALE_ES,
normalizeMessages(name, { normalizeMessages(name, {
'feedback.title': 'realimentación', 'feedback.title': 'realimentación',
...@@ -608,7 +620,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -608,7 +620,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add( useI18n().add(
LOCALE_FR, LOCALE_FR,
normalizeMessages(name, { normalizeMessages(name, {
'feedback.title': "retour d'information", 'feedback.title': "retour d'information",
...@@ -617,7 +629,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -617,7 +629,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANS, LOCALE_ZH_HANS,
normalizeMessages(name, { normalizeMessages(name, {
'feedback.title': '问题反馈', 'feedback.title': '问题反馈',
...@@ -626,7 +638,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => { ...@@ -626,7 +638,7 @@ export const initI18nButtonMsgsOnce = /*#__PURE__*/ once(() => {
) )
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add( useI18n().add(
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
normalizeMessages(name, { normalizeMessages(name, {
'feedback.title': '問題反饋', 'feedback.title': '問題反饋',
......
...@@ -228,20 +228,19 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { ...@@ -228,20 +228,19 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
], 16, ["id", "controls"]); ], 16, ["id", "controls"]);
} }
_sfc_main$1.render = _sfc_render$1; _sfc_main$1.render = _sfc_render$1;
let i18n$1; let i18n;
function useI18n() { function useI18n() {
if (!i18n$1) { if (!i18n) {
let language; let language;
{ {
{ {
language = uniShared.getEnvLocale(); language = uniShared.getEnvLocale();
} }
} }
i18n$1 = uniI18n.initVueI18n(language); i18n = uniI18n.initVueI18n(language);
} }
return i18n$1; return i18n;
} }
const i18n = /* @__PURE__ */ useI18n();
function normalizeMessages(namespace, messages) { function normalizeMessages(namespace, messages) {
return Object.keys(messages).reduce((res, name) => { return Object.keys(messages).reduce((res, name) => {
res[namespace + name] = messages[name]; res[namespace + name] = messages[name];
...@@ -251,61 +250,61 @@ function normalizeMessages(namespace, messages) { ...@@ -251,61 +250,61 @@ function normalizeMessages(namespace, messages) {
const initI18nAsyncMsgsOnce = /* @__PURE__ */ uniShared.once(() => { const initI18nAsyncMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
const name = "uni.async."; const name = "uni.async.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(uniI18n.LOCALE_EN, normalizeMessages(name, { useI18n().add(uniI18n.LOCALE_EN, normalizeMessages(name, {
error: "The connection timed out, click the screen to try again." error: "The connection timed out, click the screen to try again."
})); }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(uniI18n.LOCALE_ES, normalizeMessages(name, { useI18n().add(uniI18n.LOCALE_ES, normalizeMessages(name, {
error: "Se agot\xF3 el tiempo de conexi\xF3n, haga clic en la pantalla para volver a intentarlo." error: "Se agot\xF3 el tiempo de conexi\xF3n, haga clic en la pantalla para volver a intentarlo."
})); }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(uniI18n.LOCALE_FR, normalizeMessages(name, { useI18n().add(uniI18n.LOCALE_FR, normalizeMessages(name, {
error: "La connexion a expir\xE9, cliquez sur l'\xE9cran pour r\xE9essayer." error: "La connexion a expir\xE9, cliquez sur l'\xE9cran pour r\xE9essayer."
})); }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(uniI18n.LOCALE_ZH_HANS, normalizeMessages(name, { error: "\u8FDE\u63A5\u670D\u52A1\u5668\u8D85\u65F6\uFF0C\u70B9\u51FB\u5C4F\u5E55\u91CD\u8BD5" })); useI18n().add(uniI18n.LOCALE_ZH_HANS, normalizeMessages(name, { error: "\u8FDE\u63A5\u670D\u52A1\u5668\u8D85\u65F6\uFF0C\u70B9\u51FB\u5C4F\u5E55\u91CD\u8BD5" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(uniI18n.LOCALE_ZH_HANT, normalizeMessages(name, { error: "\u9023\u63A5\u670D\u52D9\u5668\u8D85\u6642\uFF0C\u9EDE\u64CA\u5C4F\u5E55\u91CD\u8A66" })); useI18n().add(uniI18n.LOCALE_ZH_HANT, normalizeMessages(name, { error: "\u9023\u63A5\u670D\u52D9\u5668\u8D85\u6642\uFF0C\u9EDE\u64CA\u5C4F\u5E55\u91CD\u8A66" }));
} }
}); });
const initI18nPickerMsgsOnce = /* @__PURE__ */ uniShared.once(() => { const initI18nPickerMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
const name = "uni.picker."; const name = "uni.picker.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(uniI18n.LOCALE_EN, normalizeMessages(name, { done: "Done", cancel: "Cancel" })); useI18n().add(uniI18n.LOCALE_EN, normalizeMessages(name, { done: "Done", cancel: "Cancel" }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(uniI18n.LOCALE_ES, normalizeMessages(name, { done: "OK", cancel: "Cancelar" })); useI18n().add(uniI18n.LOCALE_ES, normalizeMessages(name, { done: "OK", cancel: "Cancelar" }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(uniI18n.LOCALE_FR, normalizeMessages(name, { done: "OK", cancel: "Annuler" })); useI18n().add(uniI18n.LOCALE_FR, normalizeMessages(name, { done: "OK", cancel: "Annuler" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(uniI18n.LOCALE_ZH_HANS, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" })); useI18n().add(uniI18n.LOCALE_ZH_HANS, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(uniI18n.LOCALE_ZH_HANT, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" })); useI18n().add(uniI18n.LOCALE_ZH_HANT, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" }));
} }
}); });
const initI18nVideoMsgsOnce = /* @__PURE__ */ uniShared.once(() => { const initI18nVideoMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
const name = "uni.video."; const name = "uni.video.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(uniI18n.LOCALE_EN, normalizeMessages(name, { danmu: "Danmu", volume: "Volume" })); useI18n().add(uniI18n.LOCALE_EN, normalizeMessages(name, { danmu: "Danmu", volume: "Volume" }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(uniI18n.LOCALE_ES, normalizeMessages(name, { danmu: "Danmu", volume: "Volumen" })); useI18n().add(uniI18n.LOCALE_ES, normalizeMessages(name, { danmu: "Danmu", volume: "Volumen" }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(uniI18n.LOCALE_FR, normalizeMessages(name, { danmu: "Danmu", volume: "Le Volume" })); useI18n().add(uniI18n.LOCALE_FR, normalizeMessages(name, { danmu: "Danmu", volume: "Le Volume" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(uniI18n.LOCALE_ZH_HANS, normalizeMessages(name, { danmu: "\u5F39\u5E55", volume: "\u97F3\u91CF" })); useI18n().add(uniI18n.LOCALE_ZH_HANS, normalizeMessages(name, { danmu: "\u5F39\u5E55", volume: "\u97F3\u91CF" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(uniI18n.LOCALE_ZH_HANT, normalizeMessages(name, { danmu: "\u5F48\u5E55", volume: "\u97F3\u91CF" })); useI18n().add(uniI18n.LOCALE_ZH_HANT, normalizeMessages(name, { danmu: "\u5F48\u5E55", volume: "\u97F3\u91CF" }));
} }
}); });
const E = function() { const E = function() {
...@@ -426,7 +425,7 @@ function createSvgIconVNode(path, color = "#000", size = 27) { ...@@ -426,7 +425,7 @@ function createSvgIconVNode(path, color = "#000", size = 27) {
function useCurrentPageId() { function useCurrentPageId() {
return vue.getCurrentInstance().root.proxy.$page.id; return vue.getCurrentInstance().root.proxy.$page.id;
} }
const PAGE_META_KEYS = ["navigationBar", "refreshOptions"]; const PAGE_META_KEYS = ["navigationBar", "pullToRefresh"];
function initGlobalStyle() { function initGlobalStyle() {
return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {})); return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {}));
} }
...@@ -438,6 +437,18 @@ function mergePageMeta(id, pageMeta) { ...@@ -438,6 +437,18 @@ function mergePageMeta(id, pageMeta) {
}); });
return res; return res;
} }
function normalizePullToRefreshRpx(pullToRefresh) {
if (pullToRefresh.offset) {
pullToRefresh.offset = rpx2px(pullToRefresh.offset);
}
if (pullToRefresh.height) {
pullToRefresh.height = rpx2px(pullToRefresh.height);
}
if (pullToRefresh.range) {
pullToRefresh.range = rpx2px(pullToRefresh.range);
}
return pullToRefresh;
}
function getRealRoute(fromRoute, toRoute) { function getRealRoute(fromRoute, toRoute) {
if (toRoute.indexOf("/") === 0) { if (toRoute.indexOf("/") === 0) {
return toRoute; return toRoute;
...@@ -6547,23 +6558,19 @@ function normalizePageMeta(pageMeta) { ...@@ -6547,23 +6558,19 @@ function normalizePageMeta(pageMeta) {
if (__UNI_FEATURE_PULL_DOWN_REFRESH__) { if (__UNI_FEATURE_PULL_DOWN_REFRESH__) {
const { enablePullDownRefresh, navigationBar } = pageMeta; const { enablePullDownRefresh, navigationBar } = pageMeta;
if (enablePullDownRefresh) { if (enablePullDownRefresh) {
const refreshOptions = shared.extend({ const pullToRefresh = normalizePullToRefreshRpx(shared.extend({
support: true, support: true,
color: "#2BD009", color: "#2BD009",
style: "circle", style: "circle",
height: 70, height: 70,
range: 150, range: 150,
offset: 0 offset: 0
}, pageMeta.refreshOptions); }, pageMeta.pullToRefresh));
let offset = rpx2px(refreshOptions.offset); const { type, style } = navigationBar;
const { type } = navigationBar; if (style !== "custom" && type !== "transparent") {
if (type !== "transparent" && type !== "none") { pullToRefresh.offset += uniShared.NAVBAR_HEIGHT + 0;
offset += uniShared.NAVBAR_HEIGHT + 0;
} }
refreshOptions.offset = offset; pageMeta.pullToRefresh = pullToRefresh;
refreshOptions.height = rpx2px(refreshOptions.height);
refreshOptions.range = rpx2px(refreshOptions.range);
pageMeta.refreshOptions = refreshOptions;
} }
} }
if (__UNI_FEATURE_NAVIGATIONBAR__) { if (__UNI_FEATURE_NAVIGATIONBAR__) {
...@@ -6571,9 +6578,8 @@ function normalizePageMeta(pageMeta) { ...@@ -6571,9 +6578,8 @@ function normalizePageMeta(pageMeta) {
const { titleSize, titleColor, backgroundColor } = navigationBar; const { titleSize, titleColor, backgroundColor } = navigationBar;
navigationBar.titleText = navigationBar.titleText || ""; navigationBar.titleText = navigationBar.titleText || "";
navigationBar.type = navigationBar.type || "default"; navigationBar.type = navigationBar.type || "default";
navigationBar.backButton = pageMeta.isQuit ? false : true;
navigationBar.titleSize = titleSize || "16px"; navigationBar.titleSize = titleSize || "16px";
navigationBar.titleColor = titleColor || "#fff"; navigationBar.titleColor = titleColor || "#ffffff";
navigationBar.backgroundColor = backgroundColor || "#F7F7F7"; navigationBar.backgroundColor = backgroundColor || "#F7F7F7";
} }
return pageMeta; return pageMeta;
...@@ -10278,7 +10284,7 @@ function createBackButtonTsx(pageMeta) { ...@@ -10278,7 +10284,7 @@ function createBackButtonTsx(pageMeta) {
navigationBar, navigationBar,
isQuit isQuit
} = pageMeta; } = pageMeta;
if (navigationBar.backButton && !isQuit) { if (!isQuit) {
return vue.createVNode("div", { return vue.createVNode("div", {
"class": "uni-page-head-btn", "class": "uni-page-head-btn",
"onClick": onPageHeadBackButton "onClick": onPageHeadBackButton
...@@ -10570,10 +10576,10 @@ function usePageHeadSearchInput({ ...@@ -10570,10 +10576,10 @@ function usePageHeadSearchInput({
var _sfc_main = { var _sfc_main = {
name: "PageRefresh", name: "PageRefresh",
setup() { setup() {
const { refreshOptions } = usePageMeta(); const { pullToRefresh } = usePageMeta();
return { return {
offset: refreshOptions.offset, offset: pullToRefresh.offset,
color: refreshOptions.color color: pullToRefresh.color
}; };
} }
}; };
......
...@@ -225,20 +225,19 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { ...@@ -225,20 +225,19 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
], 16, ["id", "controls"]); ], 16, ["id", "controls"]);
} }
_sfc_main$1.render = _sfc_render$1; _sfc_main$1.render = _sfc_render$1;
let i18n$1; let i18n;
function useI18n() { function useI18n() {
if (!i18n$1) { if (!i18n) {
let language; let language;
{ {
{ {
language = navigator.language; language = navigator.language;
} }
} }
i18n$1 = initVueI18n(language); i18n = initVueI18n(language);
} }
return i18n$1; return i18n;
} }
const i18n = /* @__PURE__ */ useI18n();
function normalizeMessages(namespace, messages) { function normalizeMessages(namespace, messages) {
return Object.keys(messages).reduce((res, name) => { return Object.keys(messages).reduce((res, name) => {
res[namespace + name] = messages[name]; res[namespace + name] = messages[name];
...@@ -248,69 +247,69 @@ function normalizeMessages(namespace, messages) { ...@@ -248,69 +247,69 @@ function normalizeMessages(namespace, messages) {
const initI18nAsyncMsgsOnce = /* @__PURE__ */ once(() => { const initI18nAsyncMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.async."; const name = "uni.async.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { useI18n().add(LOCALE_EN, normalizeMessages(name, {
error: "The connection timed out, click the screen to try again." error: "The connection timed out, click the screen to try again."
})); }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { useI18n().add(LOCALE_ES, normalizeMessages(name, {
error: "Se agot\xF3 el tiempo de conexi\xF3n, haga clic en la pantalla para volver a intentarlo." error: "Se agot\xF3 el tiempo de conexi\xF3n, haga clic en la pantalla para volver a intentarlo."
})); }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { useI18n().add(LOCALE_FR, normalizeMessages(name, {
error: "La connexion a expir\xE9, cliquez sur l'\xE9cran pour r\xE9essayer." error: "La connexion a expir\xE9, cliquez sur l'\xE9cran pour r\xE9essayer."
})); }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { error: "\u8FDE\u63A5\u670D\u52A1\u5668\u8D85\u65F6\uFF0C\u70B9\u51FB\u5C4F\u5E55\u91CD\u8BD5" })); useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, { error: "\u8FDE\u63A5\u670D\u52A1\u5668\u8D85\u65F6\uFF0C\u70B9\u51FB\u5C4F\u5E55\u91CD\u8BD5" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { error: "\u9023\u63A5\u670D\u52D9\u5668\u8D85\u6642\uFF0C\u9EDE\u64CA\u5C4F\u5E55\u91CD\u8A66" })); useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, { error: "\u9023\u63A5\u670D\u52D9\u5668\u8D85\u6642\uFF0C\u9EDE\u64CA\u5C4F\u5E55\u91CD\u8A66" }));
} }
}); });
const initI18nShowActionSheetMsgsOnce = /* @__PURE__ */ once(() => { const initI18nShowActionSheetMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.showActionSheet."; const name = "uni.showActionSheet.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { cancel: "Cancel" })); useI18n().add(LOCALE_EN, normalizeMessages(name, { cancel: "Cancel" }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { cancel: "Cancelar" })); useI18n().add(LOCALE_ES, normalizeMessages(name, { cancel: "Cancelar" }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { cancel: "Annuler" })); useI18n().add(LOCALE_FR, normalizeMessages(name, { cancel: "Annuler" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { cancel: "\u53D6\u6D88" })); useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, { cancel: "\u53D6\u6D88" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { cancel: "\u53D6\u6D88" })); useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, { cancel: "\u53D6\u6D88" }));
} }
}); });
const initI18nShowToastMsgsOnce = /* @__PURE__ */ once(() => { const initI18nShowToastMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.showToast."; const name = "uni.showToast.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { useI18n().add(LOCALE_EN, normalizeMessages(name, {
unpaired: "Please note showToast must be paired with hideToast" unpaired: "Please note showToast must be paired with hideToast"
})); }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { useI18n().add(LOCALE_ES, normalizeMessages(name, {
unpaired: "Tenga en cuenta que showToast debe estar emparejado con hideToast" unpaired: "Tenga en cuenta que showToast debe estar emparejado con hideToast"
})); }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { useI18n().add(LOCALE_FR, normalizeMessages(name, {
unpaired: "Veuillez noter que showToast doit \xEAtre associ\xE9 \xE0 hideToast" unpaired: "Veuillez noter que showToast doit \xEAtre associ\xE9 \xE0 hideToast"
})); }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, {
unpaired: "\u8BF7\u6CE8\u610F showToast \u4E0E hideToast \u5FC5\u987B\u914D\u5BF9\u4F7F\u7528" unpaired: "\u8BF7\u6CE8\u610F showToast \u4E0E hideToast \u5FC5\u987B\u914D\u5BF9\u4F7F\u7528"
})); }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, {
unpaired: "\u8ACB\u6CE8\u610F showToast \u8207 hideToast \u5FC5\u9808\u914D\u5C0D\u4F7F\u7528" unpaired: "\u8ACB\u6CE8\u610F showToast \u8207 hideToast \u5FC5\u9808\u914D\u5C0D\u4F7F\u7528"
})); }));
} }
...@@ -318,27 +317,27 @@ const initI18nShowToastMsgsOnce = /* @__PURE__ */ once(() => { ...@@ -318,27 +317,27 @@ const initI18nShowToastMsgsOnce = /* @__PURE__ */ once(() => {
const initI18nShowLoadingMsgsOnce = /* @__PURE__ */ once(() => { const initI18nShowLoadingMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.showLoading."; const name = "uni.showLoading.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { useI18n().add(LOCALE_EN, normalizeMessages(name, {
unpaired: "Please note showLoading must be paired with hideLoading" unpaired: "Please note showLoading must be paired with hideLoading"
})); }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { useI18n().add(LOCALE_ES, normalizeMessages(name, {
unpaired: "Tenga en cuenta que showLoading debe estar emparejado con hideLoading" unpaired: "Tenga en cuenta que showLoading debe estar emparejado con hideLoading"
})); }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { useI18n().add(LOCALE_FR, normalizeMessages(name, {
unpaired: "Veuillez noter que showLoading doit \xEAtre associ\xE9 \xE0 hideLoading" unpaired: "Veuillez noter que showLoading doit \xEAtre associ\xE9 \xE0 hideLoading"
})); }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, {
unpaired: "\u8BF7\u6CE8\u610F showLoading \u4E0E hideLoading \u5FC5\u987B\u914D\u5BF9\u4F7F\u7528" unpaired: "\u8BF7\u6CE8\u610F showLoading \u4E0E hideLoading \u5FC5\u987B\u914D\u5BF9\u4F7F\u7528"
})); }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, {
unpaired: "\u8ACB\u6CE8\u610F showLoading \u8207 hideLoading \u5FC5\u9808\u914D\u5C0D\u4F7F\u7528" unpaired: "\u8ACB\u6CE8\u610F showLoading \u8207 hideLoading \u5FC5\u9808\u914D\u5C0D\u4F7F\u7528"
})); }));
} }
...@@ -346,55 +345,55 @@ const initI18nShowLoadingMsgsOnce = /* @__PURE__ */ once(() => { ...@@ -346,55 +345,55 @@ const initI18nShowLoadingMsgsOnce = /* @__PURE__ */ once(() => {
const initI18nShowModalMsgsOnce = /* @__PURE__ */ once(() => { const initI18nShowModalMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.showModal."; const name = "uni.showModal.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { cancel: "Cancel", confirm: "OK" })); useI18n().add(LOCALE_EN, normalizeMessages(name, { cancel: "Cancel", confirm: "OK" }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { cancel: "Cancelar", confirm: "OK" })); useI18n().add(LOCALE_ES, normalizeMessages(name, { cancel: "Cancelar", confirm: "OK" }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { cancel: "Annuler", confirm: "OK" })); useI18n().add(LOCALE_FR, normalizeMessages(name, { cancel: "Annuler", confirm: "OK" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { cancel: "\u53D6\u6D88", confirm: "\u786E\u5B9A" })); useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, { cancel: "\u53D6\u6D88", confirm: "\u786E\u5B9A" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { cancel: "\u53D6\u6D88", confirm: "\u78BA\u5B9A" })); useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, { cancel: "\u53D6\u6D88", confirm: "\u78BA\u5B9A" }));
} }
}); });
const initI18nPickerMsgsOnce = /* @__PURE__ */ once(() => { const initI18nPickerMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.picker."; const name = "uni.picker.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { done: "Done", cancel: "Cancel" })); useI18n().add(LOCALE_EN, normalizeMessages(name, { done: "Done", cancel: "Cancel" }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { done: "OK", cancel: "Cancelar" })); useI18n().add(LOCALE_ES, normalizeMessages(name, { done: "OK", cancel: "Cancelar" }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { done: "OK", cancel: "Annuler" })); useI18n().add(LOCALE_FR, normalizeMessages(name, { done: "OK", cancel: "Annuler" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" })); useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" })); useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, { done: "\u5B8C\u6210", cancel: "\u53D6\u6D88" }));
} }
}); });
const initI18nVideoMsgsOnce = /* @__PURE__ */ once(() => { const initI18nVideoMsgsOnce = /* @__PURE__ */ once(() => {
const name = "uni.video."; const name = "uni.video.";
if (__UNI_FEATURE_I18N_EN__) { if (__UNI_FEATURE_I18N_EN__) {
i18n.add(LOCALE_EN, normalizeMessages(name, { danmu: "Danmu", volume: "Volume" })); useI18n().add(LOCALE_EN, normalizeMessages(name, { danmu: "Danmu", volume: "Volume" }));
} }
if (__UNI_FEATURE_I18N_ES__) { if (__UNI_FEATURE_I18N_ES__) {
i18n.add(LOCALE_ES, normalizeMessages(name, { danmu: "Danmu", volume: "Volumen" })); useI18n().add(LOCALE_ES, normalizeMessages(name, { danmu: "Danmu", volume: "Volumen" }));
} }
if (__UNI_FEATURE_I18N_FR__) { if (__UNI_FEATURE_I18N_FR__) {
i18n.add(LOCALE_FR, normalizeMessages(name, { danmu: "Danmu", volume: "Le Volume" })); useI18n().add(LOCALE_FR, normalizeMessages(name, { danmu: "Danmu", volume: "Le Volume" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANS__) { if (__UNI_FEATURE_I18N_ZH_HANS__) {
i18n.add(LOCALE_ZH_HANS, normalizeMessages(name, { danmu: "\u5F39\u5E55", volume: "\u97F3\u91CF" })); useI18n().add(LOCALE_ZH_HANS, normalizeMessages(name, { danmu: "\u5F39\u5E55", volume: "\u97F3\u91CF" }));
} }
if (__UNI_FEATURE_I18N_ZH_HANT__) { if (__UNI_FEATURE_I18N_ZH_HANT__) {
i18n.add(LOCALE_ZH_HANT, normalizeMessages(name, { danmu: "\u5F48\u5E55", volume: "\u97F3\u91CF" })); useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, { danmu: "\u5F48\u5E55", volume: "\u97F3\u91CF" }));
} }
}); });
const E = function() { const E = function() {
...@@ -813,7 +812,7 @@ function getPageIdByVm(vm) { ...@@ -813,7 +812,7 @@ function getPageIdByVm(vm) {
return rootProxy.$page.id; return rootProxy.$page.id;
} }
} }
const PAGE_META_KEYS = ["navigationBar", "refreshOptions"]; const PAGE_META_KEYS = ["navigationBar", "pullToRefresh"];
function initGlobalStyle() { function initGlobalStyle() {
return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {})); return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {}));
} }
...@@ -825,6 +824,18 @@ function mergePageMeta(id2, pageMeta) { ...@@ -825,6 +824,18 @@ function mergePageMeta(id2, pageMeta) {
}); });
return res; return res;
} }
function normalizePullToRefreshRpx(pullToRefresh) {
if (pullToRefresh.offset) {
pullToRefresh.offset = rpx2px(pullToRefresh.offset);
}
if (pullToRefresh.height) {
pullToRefresh.height = rpx2px(pullToRefresh.height);
}
if (pullToRefresh.range) {
pullToRefresh.range = rpx2px(pullToRefresh.range);
}
return pullToRefresh;
}
function disableScrollListener(evt) { function disableScrollListener(evt) {
evt.preventDefault(); evt.preventDefault();
} }
...@@ -13021,23 +13032,19 @@ function normalizePageMeta(pageMeta) { ...@@ -13021,23 +13032,19 @@ function normalizePageMeta(pageMeta) {
if (__UNI_FEATURE_PULL_DOWN_REFRESH__) { if (__UNI_FEATURE_PULL_DOWN_REFRESH__) {
const { enablePullDownRefresh, navigationBar } = pageMeta; const { enablePullDownRefresh, navigationBar } = pageMeta;
if (enablePullDownRefresh) { if (enablePullDownRefresh) {
const refreshOptions = extend({ const pullToRefresh = normalizePullToRefreshRpx(extend({
support: true, support: true,
color: "#2BD009", color: "#2BD009",
style: "circle", style: "circle",
height: 70, height: 70,
range: 150, range: 150,
offset: 0 offset: 0
}, pageMeta.refreshOptions); }, pageMeta.pullToRefresh));
let offset = rpx2px(refreshOptions.offset); const { type, style } = navigationBar;
const { type } = navigationBar; if (style !== "custom" && type !== "transparent") {
if (type !== "transparent" && type !== "none") { pullToRefresh.offset += NAVBAR_HEIGHT + out.top;
offset += NAVBAR_HEIGHT + out.top;
} }
refreshOptions.offset = offset; pageMeta.pullToRefresh = pullToRefresh;
refreshOptions.height = rpx2px(refreshOptions.height);
refreshOptions.range = rpx2px(refreshOptions.range);
pageMeta.refreshOptions = refreshOptions;
} }
} }
if (__UNI_FEATURE_NAVIGATIONBAR__) { if (__UNI_FEATURE_NAVIGATIONBAR__) {
...@@ -13045,9 +13052,8 @@ function normalizePageMeta(pageMeta) { ...@@ -13045,9 +13052,8 @@ function normalizePageMeta(pageMeta) {
const { titleSize, titleColor, backgroundColor } = navigationBar; const { titleSize, titleColor, backgroundColor } = navigationBar;
navigationBar.titleText = navigationBar.titleText || ""; navigationBar.titleText = navigationBar.titleText || "";
navigationBar.type = navigationBar.type || "default"; navigationBar.type = navigationBar.type || "default";
navigationBar.backButton = pageMeta.isQuit ? false : true;
navigationBar.titleSize = titleSize || "16px"; navigationBar.titleSize = titleSize || "16px";
navigationBar.titleColor = titleColor || "#fff"; navigationBar.titleColor = titleColor || "#ffffff";
navigationBar.backgroundColor = backgroundColor || "#F7F7F7"; navigationBar.backgroundColor = backgroundColor || "#F7F7F7";
} }
if (__UNI_FEATURE_PAGES__ && history.state) { if (__UNI_FEATURE_PAGES__ && history.state) {
...@@ -17372,6 +17378,9 @@ var modal = /* @__PURE__ */ defineComponent({ ...@@ -17372,6 +17378,9 @@ var modal = /* @__PURE__ */ defineComponent({
} }
}); });
let showModalState; let showModalState;
const onHidePopupOnce$2 = /* @__PURE__ */ once(() => {
UniServiceJSBridge.on("onHidePopup", () => showModalState.visible = false);
});
let currentShowModalResolve; let currentShowModalResolve;
function onModalClose(type) { function onModalClose(type) {
currentShowModalResolve && currentShowModalResolve({ currentShowModalResolve && currentShowModalResolve({
...@@ -17380,6 +17389,7 @@ function onModalClose(type) { ...@@ -17380,6 +17389,7 @@ function onModalClose(type) {
}); });
} }
const showModal = /* @__PURE__ */ defineAsyncApi(API_SHOW_MODAL, (args, { resolve }) => { const showModal = /* @__PURE__ */ defineAsyncApi(API_SHOW_MODAL, (args, { resolve }) => {
onHidePopupOnce$2();
currentShowModalResolve = resolve; currentShowModalResolve = resolve;
if (!showModalState) { if (!showModalState) {
showModalState = reactive(args); showModalState = reactive(args);
...@@ -17488,7 +17498,7 @@ function useToastIcon(props2) { ...@@ -17488,7 +17498,7 @@ function useToastIcon(props2) {
let showToastState; let showToastState;
let showType = ""; let showType = "";
let timeoutId; let timeoutId;
const onHidePopupOnce = /* @__PURE__ */ once(() => { const onHidePopupOnce$1 = /* @__PURE__ */ once(() => {
UniServiceJSBridge.on("onHidePopup", () => hidePopup("onHidePopup")); UniServiceJSBridge.on("onHidePopup", () => hidePopup("onHidePopup"));
}); });
function createToast(args) { function createToast(args) {
...@@ -17514,7 +17524,7 @@ function createToast(args) { ...@@ -17514,7 +17524,7 @@ function createToast(args) {
timeoutId && clearTimeout(timeoutId); timeoutId && clearTimeout(timeoutId);
} }
}); });
onHidePopupOnce(); onHidePopupOnce$1();
} }
const showToast = /* @__PURE__ */ defineAsyncApi(API_SHOW_TOAST, (args, { resolve, reject }) => { const showToast = /* @__PURE__ */ defineAsyncApi(API_SHOW_TOAST, (args, { resolve, reject }) => {
createToast(args); createToast(args);
...@@ -17854,6 +17864,9 @@ function initClick(dom) { ...@@ -17854,6 +17864,9 @@ function initClick(dom) {
let resolveAction; let resolveAction;
let rejectAction; let rejectAction;
let showActionSheetState; let showActionSheetState;
const onHidePopupOnce = /* @__PURE__ */ once(() => {
UniServiceJSBridge.on("onHidePopup", () => showActionSheetState.visible = false);
});
function onActionSheetClose(tapIndex) { function onActionSheetClose(tapIndex) {
if (tapIndex === -1) { if (tapIndex === -1) {
rejectAction && rejectAction("cancel"); rejectAction && rejectAction("cancel");
...@@ -17862,6 +17875,7 @@ function onActionSheetClose(tapIndex) { ...@@ -17862,6 +17875,7 @@ function onActionSheetClose(tapIndex) {
} }
} }
const showActionSheet = /* @__PURE__ */ defineAsyncApi(API_SHOW_ACTION_SHEET, (args, { resolve, reject }) => { const showActionSheet = /* @__PURE__ */ defineAsyncApi(API_SHOW_ACTION_SHEET, (args, { resolve, reject }) => {
onHidePopupOnce();
resolveAction = resolve; resolveAction = resolve;
rejectAction = reject; rejectAction = reject;
if (!showActionSheetState) { if (!showActionSheetState) {
...@@ -20349,7 +20363,7 @@ function createBackButtonTsx(pageMeta) { ...@@ -20349,7 +20363,7 @@ function createBackButtonTsx(pageMeta) {
navigationBar, navigationBar,
isQuit isQuit
} = pageMeta; } = pageMeta;
if (navigationBar.backButton && !isQuit) { if (!isQuit) {
return createVNode("div", { return createVNode("div", {
"class": "uni-page-head-btn", "class": "uni-page-head-btn",
"onClick": onPageHeadBackButton "onClick": onPageHeadBackButton
...@@ -20642,10 +20656,10 @@ function usePageHeadSearchInput({ ...@@ -20642,10 +20656,10 @@ function usePageHeadSearchInput({
var _sfc_main = { var _sfc_main = {
name: "PageRefresh", name: "PageRefresh",
setup() { setup() {
const { refreshOptions } = usePageMeta(); const { pullToRefresh } = usePageMeta();
return { return {
offset: refreshOptions.offset, offset: pullToRefresh.offset,
color: refreshOptions.color color: pullToRefresh.color
}; };
} }
}; };
...@@ -20709,8 +20723,8 @@ const ABORTING = "aborting"; ...@@ -20709,8 +20723,8 @@ const ABORTING = "aborting";
const REFRESHING = "refreshing"; const REFRESHING = "refreshing";
const RESTORING = "restoring"; const RESTORING = "restoring";
function usePageRefresh(refreshRef) { function usePageRefresh(refreshRef) {
const { id: id2, refreshOptions } = usePageMeta(); const { id: id2, pullToRefresh } = usePageMeta();
const { range, height } = refreshOptions; const { range, height } = pullToRefresh;
let refreshContainerElem; let refreshContainerElem;
let refreshControllerElem; let refreshControllerElem;
let refreshControllerElemStyle; let refreshControllerElemStyle;
......
...@@ -40,10 +40,10 @@ import { usePageMeta } from '../../../setup/provide' ...@@ -40,10 +40,10 @@ import { usePageMeta } from '../../../setup/provide'
export default { export default {
name: 'PageRefresh', name: 'PageRefresh',
setup() { setup() {
const { refreshOptions } = usePageMeta() const { pullToRefresh } = usePageMeta()
return { return {
offset: refreshOptions!.offset, offset: pullToRefresh!.offset,
color: refreshOptions!.color, color: pullToRefresh!.color,
} }
}, },
} }
......
...@@ -32,8 +32,8 @@ const REFRESHING = 'refreshing' ...@@ -32,8 +32,8 @@ const REFRESHING = 'refreshing'
const RESTORING = 'restoring' const RESTORING = 'restoring'
export function usePageRefresh(refreshRef: Ref) { export function usePageRefresh(refreshRef: Ref) {
const { id, refreshOptions } = usePageMeta() const { id, pullToRefresh } = usePageMeta()
const { range, height } = refreshOptions! const { range, height } = pullToRefresh!
let refreshContainerElem: HTMLDivElement let refreshContainerElem: HTMLDivElement
let refreshControllerElem: HTMLDivElement let refreshControllerElem: HTMLDivElement
let refreshControllerElemStyle: CSSStyleDeclaration let refreshControllerElemStyle: CSSStyleDeclaration
...@@ -231,7 +231,7 @@ export function usePageRefresh(refreshRef: Ref) { ...@@ -231,7 +231,7 @@ export function usePageRefresh(refreshRef: Ref) {
refreshControllerElemStyle.transition = '-webkit-transform 0.2s' refreshControllerElemStyle.transition = '-webkit-transform 0.2s'
refreshControllerElemStyle.transform = refreshControllerElemStyle.transform =
'translate3d(-50%, ' + height + 'px, 0)' 'translate3d(-50%, ' + height + 'px, 0)'
invokeHook(id, 'onPullDownRefresh') invokeHook(id!, 'onPullDownRefresh')
} }
function restoring(callback: Function) { function restoring(callback: Function) {
......
...@@ -89,7 +89,7 @@ export default /*#__PURE__*/ defineSystemComponent({ ...@@ -89,7 +89,7 @@ export default /*#__PURE__*/ defineSystemComponent({
function createBackButtonTsx(pageMeta: UniApp.PageRouteMeta) { function createBackButtonTsx(pageMeta: UniApp.PageRouteMeta) {
const { navigationBar, isQuit } = pageMeta const { navigationBar, isQuit } = pageMeta
if (navigationBar.backButton && !isQuit) { if (!isQuit) {
return ( return (
<div class="uni-page-head-btn" onClick={onPageHeadBackButton}> <div class="uni-page-head-btn" onClick={onPageHeadBackButton}>
{createSvgIconVNode( {createSvgIconVNode(
......
...@@ -3,7 +3,11 @@ import { reactive, provide, inject } from 'vue' ...@@ -3,7 +3,11 @@ import { reactive, provide, inject } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { NAVBAR_HEIGHT, parseQuery } from '@dcloudio/uni-shared' import { NAVBAR_HEIGHT, parseQuery } from '@dcloudio/uni-shared'
import { mergePageMeta, PolySymbol, rpx2px } from '@dcloudio/uni-core' import {
mergePageMeta,
normalizePullToRefreshRpx,
PolySymbol,
} from '@dcloudio/uni-core'
import safeAreaInsets from 'safe-area-insets' import safeAreaInsets from 'safe-area-insets'
...@@ -64,26 +68,25 @@ function normalizePageMeta(pageMeta: UniApp.PageRouteMeta) { ...@@ -64,26 +68,25 @@ function normalizePageMeta(pageMeta: UniApp.PageRouteMeta) {
if (__UNI_FEATURE_PULL_DOWN_REFRESH__) { if (__UNI_FEATURE_PULL_DOWN_REFRESH__) {
const { enablePullDownRefresh, navigationBar } = pageMeta const { enablePullDownRefresh, navigationBar } = pageMeta
if (enablePullDownRefresh) { if (enablePullDownRefresh) {
const refreshOptions = extend( const pullToRefresh = normalizePullToRefreshRpx(
{ extend(
support: true, {
color: '#2BD009', support: true,
style: 'circle', color: '#2BD009',
height: 70, style: 'circle',
range: 150, height: 70,
offset: 0, range: 150,
}, offset: 0,
pageMeta.refreshOptions },
pageMeta.pullToRefresh
)
) )
let offset = rpx2px(refreshOptions.offset) const { type, style } = navigationBar
const { type } = navigationBar if (style !== 'custom' && type !== 'transparent') {
if (type !== 'transparent' && type !== 'none') { pullToRefresh.offset +=
offset += NAVBAR_HEIGHT + (__NODE_JS__ ? 0 : safeAreaInsets.top) NAVBAR_HEIGHT + (__NODE_JS__ ? 0 : safeAreaInsets.top)
} }
refreshOptions.offset = offset pageMeta.pullToRefresh = pullToRefresh
refreshOptions.height = rpx2px(refreshOptions.height)
refreshOptions.range = rpx2px(refreshOptions.range)
pageMeta.refreshOptions = refreshOptions
} }
} }
if (__UNI_FEATURE_NAVIGATIONBAR__) { if (__UNI_FEATURE_NAVIGATIONBAR__) {
...@@ -91,9 +94,8 @@ function normalizePageMeta(pageMeta: UniApp.PageRouteMeta) { ...@@ -91,9 +94,8 @@ function normalizePageMeta(pageMeta: UniApp.PageRouteMeta) {
const { titleSize, titleColor, backgroundColor } = navigationBar const { titleSize, titleColor, backgroundColor } = navigationBar
navigationBar.titleText = navigationBar.titleText || '' navigationBar.titleText = navigationBar.titleText || ''
navigationBar.type = navigationBar.type || 'default' navigationBar.type = navigationBar.type || 'default'
navigationBar.backButton = pageMeta.isQuit ? false : true
navigationBar.titleSize = titleSize || '16px' navigationBar.titleSize = titleSize || '16px'
navigationBar.titleColor = titleColor || '#fff' navigationBar.titleColor = titleColor || '#ffffff'
navigationBar.backgroundColor = backgroundColor || '#F7F7F7' navigationBar.backgroundColor = backgroundColor || '#F7F7F7'
} }
if (!__NODE_JS__ && __UNI_FEATURE_PAGES__ && history.state) { if (!__NODE_JS__ && __UNI_FEATURE_PAGES__ && history.state) {
......
import { cac } from 'cac' import { cac } from 'cac'
import chalk from 'chalk' import chalk from 'chalk'
import { extend } from '@vue/shared'
import { LogLevel, createLogger, ServerOptions, BuildOptions } from 'vite' import { LogLevel, createLogger, ServerOptions, BuildOptions } from 'vite'
import { build, buildSSR } from './build' import { build, buildSSR } from './build'
import { createServer, createSSRServer } from './server' import { createServer, createSSRServer } from './server'
...@@ -52,7 +53,11 @@ cli ...@@ -52,7 +53,11 @@ cli
.action(async (options: CliOptions & ServerOptions) => { .action(async (options: CliOptions & ServerOptions) => {
initEnv('dev', options) initEnv('dev', options)
try { try {
await (options.ssr ? createSSRServer(options) : createServer(options)) if (options.platform === 'h5') {
await (options.ssr ? createSSRServer(options) : createServer(options))
} else {
await build(extend(options, { watch: true }))
}
} catch (e) { } catch (e) {
createLogger(options.logLevel).error( createLogger(options.logLevel).error(
chalk.red(`error when starting dev server:\n${e.stack}`) chalk.red(`error when starting dev server:\n${e.stack}`)
......
...@@ -51,7 +51,7 @@ import { ...@@ -51,7 +51,7 @@ import {
LOCALE_ZH_HANT, LOCALE_ZH_HANT,
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import { useI18n } from './useI18n' import { useI18n } from './useI18n'
const i18n = /*#__PURE__*/ useI18n()
function normalizeMessages( function normalizeMessages(
namespace: string, namespace: string,
messages: Record<string, string> messages: Record<string, string>
...@@ -83,7 +83,7 @@ ${Object.keys(localeMessages) ...@@ -83,7 +83,7 @@ ${Object.keys(localeMessages)
function generateI18nModuleLocaleCode(locale, messages) { function generateI18nModuleLocaleCode(locale, messages) {
locale = locale.toUpperCase().replace('-', '_') locale = locale.toUpperCase().replace('-', '_')
return ` if (__UNI_FEATURE_I18N_${locale}__) { return ` if (__UNI_FEATURE_I18N_${locale}__) {
i18n.add(LOCALE_${locale}, normalizeMessages(name, ${JSON.stringify( useI18n().add(LOCALE_${locale}, normalizeMessages(name, ${JSON.stringify(
messages messages
)})) )}))
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册