i have a series of div
added after mounted
:
mounted(){
// let self = this
let connect = document.querySelector('.connect')
let h2 = 97.5;
connect.setAttribute('style','width:60px; height:'+h+'px')
var i;
for(i = 0 ; i < 8 ; i++ ){
let linker_node = document.createElement('div')
linker_node.setAttribute('style','width:60px; height:'+ h2 +'px')
i%2 ? linker_node.setAttribute('class','linker toplink'):linker_node.setAttribute('class','linker bottomlink')
connect.appendChild(linker_node)
}
and my css
:
.toplink{
background:#fff;
}
.bottomlink{
background:grey;
}
which finally I will get html
:
<div data-v-57e2cc88="" class="connect" style="width:60px; height:780px">
<div class="linker bottomlink" style="width:60px; height:97.5px"></div>
<div class="linker toplink" style="width:60px; height:97.5px"></div>
<div class="linker bottomlink" style="width:60px; height:97.5px"></div>
<div class="linker toplink" style="width:60px; height:97.5px"></div>
<div class="linker bottomlink" style="width:60px; height:97.5px"></div>
<div class="linker toplink" style="width:60px; height:97.5px"></div>
<div class="linker bottomlink" style="width:60px; height:97.5px"></div>
<div class="linker toplink" style="width:60px; height:97.5px"></div>
</div>
but the css background
did not rendered. i check chrome inspect
:
as the image shown, the class toplink
/bottomlink
did not show up at all.
I believe this is something to do with vue
life cycle hook, but not sure how to debug it.
How can I resolve this?