I'm trying to dynamically set the width of my innermost element equal to the width of the outermost element using Vue:
<div id="banner-container" class="row">
<div class="col-xs-12">
<div class="card mb-2">
<div class="banner banner-tag card-body" :style="getBannerStyle"></div>
</div>
</div>
</div>
I have the following code in Javascript and computed property in Vue:
var container = document.getElementById('banner-container').offsetWidth;
...
computed: {
getBannerStyle () {
return 'width: ' + container + 'px;';
}
}