re-enable ad

This commit is contained in:
liangping 2024-04-28 09:00:18 +08:00
parent 21feb03ece
commit 0a552e78de
2 changed files with 17 additions and 17 deletions

View File

@ -10,22 +10,21 @@ const props = defineProps({
});
const show = ref(false)
// onMounted(() => {
// const adClient = getClient();
// const adUnitId = getUnit(props.unit);
// show.value = adClient !== undefined && adUnitId !== undefined;
onMounted(() => {
const adClient = getClient();
const adUnitId = getUnit(props.unit);
show.value = adClient !== undefined && adUnitId !== undefined;
// if(show.value) {
// adClient.showBannerAd({
// adUnitId,
// containerId: props.id,
// });
// }
// });
if(show.value) {
adClient.showBannerAd({
adUnitId,
containerId: props.id,
});
}
});
</script>
<template>
<div v-show="show" class="grid justify-items-center overflow-auto">
<div v-show="show" :id="id" :unit="unit" class="grid justify-items-center overflow-auto pt-4">
</div>
</template>

View File

@ -6,10 +6,10 @@ interface ADConfig {
}
export const confs: Record<string, ADConfig> = {
// "localhost": {
// apiKey: 'XXXX_api_key_staging_XXXX', // An actual API key is generated once you register an app with us.
// environment: 'staging', // use value 'production' when going live
// },
"localhost": {
apiKey: 'XXXX_api_key_staging_XXXX', // An actual API key is generated once you register an app with us.
environment: 'staging', // use value 'production' when going live
},
"ping.pub": {
apiKey: 'persona-pub-0x6ca028de83d9bc438bb3fd7f9620f36b',
environment: 'production',
@ -34,6 +34,7 @@ export const UNITS: Record<string, Record<string, string>> = {
"banner": "1644951b-5022-4544-8a85-11aef8a8f645",
"banner_mobile": "81e0527f-475a-42a4-bb9a-ed9967c5d06f",
},
}
export function getClient() {