use dynamic URL parameter

This commit is contained in:
Hayden 2023-02-12 15:04:23 -09:00
parent c416161a7b
commit 1959042c60
No known key found for this signature in database
GPG key ID: 17CF79474E257545

View file

@ -10,6 +10,7 @@
const bordered = ref(false); const bordered = ref(false);
const displayProperties = reactive({ const displayProperties = reactive({
baseURL: window.location.origin,
assetRange: 1, assetRange: 1,
assetRangeMax: 91, assetRangeMax: 91,
gapY: 0.25, gapY: 0.25,
@ -97,6 +98,7 @@
interface InputDef { interface InputDef {
label: string; label: string;
ref: keyof typeof displayProperties; ref: keyof typeof displayProperties;
type?: "number" | "text";
} }
const propertyInputs = computed<InputDef[]>(() => { const propertyInputs = computed<InputDef[]>(() => {
@ -141,6 +143,11 @@
label: "Page Right Padding", label: "Page Right Padding",
ref: "pageRightPadding", ref: "pageRightPadding",
}, },
{
label: "Base URL",
ref: "baseURL",
type: "text",
},
]; ];
}); });
@ -162,7 +169,12 @@
} }
function getQRCodeUrl(assetID: string): string { function getQRCodeUrl(assetID: string): string {
const origin = window.location.origin; let origin = displayProperties.baseURL.trim();
// remove trailing slash
if (origin.endsWith("/")) {
origin = origin.slice(0, -1);
}
const data = `${origin}/a/${assetID}`; const data = `${origin}/a/${assetID}`;
@ -334,7 +346,7 @@
</label> </label>
<input <input
v-model="displayProperties[prop.ref]" v-model="displayProperties[prop.ref]"
type="number" :type="prop.type ? prop.type : 'number'"
step="0.01" step="0.01"
placeholder="Type here" placeholder="Type here"
class="input input-bordered w-full max-w-xs" class="input input-bordered w-full max-w-xs"
@ -351,6 +363,7 @@
</div> </div>
<div> <div>
<p>QR Code Example {{ displayProperties.baseURL }}/a/{asset_id}</p>
<BaseButton class="btn-block my-4" @click="calcPages"> Generate Page </BaseButton> <BaseButton class="btn-block my-4" @click="calcPages"> Generate Page </BaseButton>
</div> </div>
</div> </div>