Commit 892d13f0 authored by 郑磊's avatar 郑磊

直播app使用的扩展参数

parent b62800d3
...@@ -7,12 +7,30 @@ const requestCaptchaDataUrl = import.meta.env.VITE_REQUEST_CAPTCHA_URL ...@@ -7,12 +7,30 @@ const requestCaptchaDataUrl = import.meta.env.VITE_REQUEST_CAPTCHA_URL
const validCaptchaUrl = import.meta.env.VITE_VALID_CAPTCHA_URL const validCaptchaUrl = import.meta.env.VITE_VALID_CAPTCHA_URL
//通过URL上的参数解析验证码组件的参数 //通过URL上的参数解析验证码组件的参数
const { locale } = (() => { const { locale, extra } = (() => {
const url = new URL(location.href) const url = new URL(location.href)
const locale = url.searchParams.get('lang') ?? undefined const locale = url.searchParams.get('lang') ?? undefined
const extra = (() => {
const json = url.searchParams.get('extra')
if (json) {
try {
const extra = JSON.parse(json)
if (
typeof extra === 'object' &&
extra !== null &&
!Array.isArray(extra)
) {
return extra
}
} catch {}
return {}
}
})()
return { return {
locale, locale,
extra,
} }
})() })()
...@@ -33,6 +51,7 @@ const onSuccess = (id: string) => { ...@@ -33,6 +51,7 @@ const onSuccess = (id: string) => {
:validCaptchaUrl="validCaptchaUrl" :validCaptchaUrl="validCaptchaUrl"
:showClose="false" :showClose="false"
:locale="locale" :locale="locale"
:extra="extra"
@success="onSuccess" @success="onSuccess"
/> />
</template> </template>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment