Make ad stateless again

This commit is contained in:
Sam Carlton 2022-07-27 13:11:28 -05:00
parent d882191df8
commit 9e817f0f6c

View file

@ -38,8 +38,6 @@
/* Carbon ads */
import CarbonInline from './carbon-inline.vue'
const transparentImage = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
const ads = {
// Since Vue renders the ad on the server
// but destroys the ad when hydrating on
@ -48,7 +46,7 @@ const ads = {
// and so that our ad css still get's imported.
'placeholder': {
url: '/',
imageSrc: transparentImage,
imageSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
imageAlt: '',
copy: '',
corner: '',
@ -98,16 +96,9 @@ export default {
default: () => ({})
}
},
data () {
return {
// We store imageSrc in data
// so that vue knows to update attribute after hydration.
imageSrc: transparentImage,
}
},
computed: {
adName () {
// console.log( 'kindName', this.page?.kindName )
console.log( 'kindName', this.page?.kindName )
if ( this.name === 'placeholder' ) {
return 'placeholder'
@ -122,10 +113,13 @@ export default {
},
ad () {
return ads[ this.adName ]
},
imageSrc () {
return this.ad.imageSrc
}
},
mounted () {
this.imageSrc = this.ad.imageSrc
console.log( 'mounted', this.adName )
}
}
</script>