JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
<div id="root">
<div id="container">
<div id="square">
a
</div>
<div v-html="text">
</div>
</div>
</div>
CSS
#container {
display: flex;
flex-direction: row;
border-style: solid;
border-width: 5px;
}
div {
border-style: solid;
border-width: 1px;
}
JavaScript
var vm = new Vue({
el: "#root",
data: {
text: ""
},
watch: {
text: function() {
Vue.nextTick(function() {
document.getElementById("square").setAttribute("style","width:"+ document.getElementById("container").offsetHeight + 'px')
})
}
}
})
setTimeout(function() {
vm.text = "this is some text<br>and some morethis is some text<br>and some morethis is some text<br>and some morethis is some text<br>and some more"
}, 3000)