4
Ich verwende eine Vorlage mit einem Stil-Block, die muss in der Nähe sein div für CMS Gründe.Vue.js trennen Stile von Vorlage
Als ich Vue.js laufen, es scheint, es zu entfernen, sagte
- Templates should only be responsible for mapping the state to the UI.
Avoid placing tags with side-effects in your templates, such as <style>,
as they will not be parsed.
Was kann ich tun?
var app = new Vue({
el: '#app'
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.0/vue.js"></script>
<div id="app">
<style>
#div_123 {
background: http://placehold.it/850x150;
}
@media screen and (max-width: 640px) {
#div_123 {
background: http://placehold.it/350x150;
}
}
</style>
<div id="div_123">
Test
</div>
</div>
Können Sie die Gründe angeben, warum es so nah am div sein muss? –
Ich verwende dynamische Hintergrundbilder, die an mein div gebunden sind und ich kann sie nicht für CMS-Zwecke irgendwo anders als hier platzieren ... –
Wird der Stil mit einer Komponente oder nur einem Vue assoziiert? – Bert