0👍
Can you try following for stack.vue:
<template>
<slot />
</template>
<script>
export default {
methods: {
updateDOMCls() {
document.querySelectorAll('.Stack__firstEl').forEach(function(el) {
el.classList.add('mt-32');
})
document.querySelectorAll('.Stack__otherEl').forEach(function(el) {
el.classList.add('mt-12');
})
}
},
mounted() {
this.updateDOMCls();
}
}
</script>
And leverage slot to provide dynamic components. PLEASE ENSURE TO GIVE CLASSES Stack_firstEl and Stack_otherEl:
<stack>
<div class="Stack__firstEl"></div>
<div class="Stack__otherEl"></div>
<div class="Stack__otherEl"></div>
<div class="Stack__otherEl"></div>
</stack>
- [Vuejs]-VueJS the single page template won´t render
- [Vuejs]-How do I make it so that I can edit my vue to do list to add items?
Source:stackexchange.com