1. 海报
This commit is contained in:
@@ -474,6 +474,19 @@
|
||||
<a-input v-model:value="posterCfg.invitePath" placeholder="/" />
|
||||
</a-form-item>
|
||||
</div>
|
||||
<a-form-item label="页面标题(浏览器标签 / 分享)">
|
||||
<a-input
|
||||
v-model:value="posterCfg.pageTitle"
|
||||
:placeholder="currentPosterSide.label + '海报页面标题'"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="页面描述 description">
|
||||
<a-textarea
|
||||
v-model:value="posterCfg.pageDescription"
|
||||
:rows="2"
|
||||
placeholder="用于 meta description / 分享摘要"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item :label="posterCfg.template === 'split' ? '左侧照片' : '顶部照片'">
|
||||
<image-field
|
||||
v-model="posterCfg.heroImg"
|
||||
|
||||
@@ -138,6 +138,32 @@ function goInvite() {
|
||||
else router.push(path)
|
||||
}
|
||||
|
||||
function upsertMeta(attr, key, content) {
|
||||
if (!content) return
|
||||
let el = document.head.querySelector(`meta[${attr}="${key}"]`)
|
||||
if (!el) {
|
||||
el = document.createElement('meta')
|
||||
el.setAttribute(attr, key)
|
||||
document.head.appendChild(el)
|
||||
}
|
||||
el.setAttribute('content', content)
|
||||
}
|
||||
|
||||
function applyPageMeta() {
|
||||
const title = String(cfg.pageTitle || cfg.title || posterSideMeta(cfg.side).label || '').trim()
|
||||
const desc = String(cfg.pageDescription || '').trim()
|
||||
if (title) {
|
||||
document.title = title
|
||||
upsertMeta('property', 'og:title', title)
|
||||
upsertMeta('name', 'twitter:title', title)
|
||||
}
|
||||
if (desc) {
|
||||
upsertMeta('name', 'description', desc)
|
||||
upsertMeta('property', 'og:description', desc)
|
||||
upsertMeta('name', 'twitter:description', desc)
|
||||
}
|
||||
}
|
||||
|
||||
async function mountCaptureQr(host) {
|
||||
const isSplit = host.classList.contains('sp-card')
|
||||
const target = isSplit
|
||||
@@ -249,6 +275,7 @@ onMounted(async () => {
|
||||
} catch {
|
||||
Object.assign(cfg, normalizePosterConfig(null, side))
|
||||
}
|
||||
applyPageMeta()
|
||||
runSequence()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user