I have two v-html objects loading. One text inside a span tag and one link inside an anchor tag. The text is the cookiebar description and the link is link to the modal with options. I would like both of them to load in the same html tag so I can make them one node for wrapping the block on mobile as one block instead of two.
Background
With current flexbox setup I can only do all in one row or one column using flex-direction. With display block of description and link wrapper and span and a as inline blocks I do get link to wrap party below description as we like, but on desktop or wide screen all gets stacked.
Goal
So trying to make this work by putting both items in one html node. That way on smaler screen sizes the whole descriptionm+link block will fold as one and look like a unit on mobile followed by agree button.
Current Cookie Component
Current code that does flex row or flex column style with separately loading description and link content:
...
<div class="cookieContainer" :style="containerStyle">
<div class="content" :style="contentStyle">
<span v-html="object.description" :style="descriptionStyle"></span>
<a @click="showCookies" href="javascript:void(0)" :style="linkStyle" v-html="object.linkLabel"></a>
</div>
<button class="btn" :style="agreeStyle" @click="agree" v-html="object.buttonLabel"></button>
</div>
...
descriptionStyle() {
return {
marginLeft: `${this.object.descriptionMarginLeft}px`,
marginRight: `${this.object.descriptionMarginRight}px`,
marginTop: `${this.object.descriptionMarginTop}px`,
marginBottom: `${this.object.descriptionMarginBottom}px`,
}
},
linkStyle() {
return {
marginLeft: `${this.object.linkMarginLeft}px`,
marginRight: `${this.object.linkMarginRight}px`,
marginTop: `${this.object.linkMarginTop}px`,
marginBottom: `${this.object.linkMarginBottom}px`,
color: this.object.linkColor,
width: this.object.isEnableStack ? '100%' : 'initial',
}
},
contentStyle() {
return {
flexWrap: this.object.isEnableStack ? 'wrap' : 'initial',
width: this.object.isEnableStack ? '100%' : 'initial',
}
}
},
...
<style scoped lang="scss">
.cookieContainer {
display: flex;
height: 100%;
align-items: center;
}
.cookieContainer .content {
flex: 1 1 auto;
display: flex;
}
...
It is possible to load the two in one html node/block? This so they fold as one when there is not enough space to acoomdate all? How would I approach this?