我用的Symfony 4和VueJS 2个工作,一切都很好地工作,除了我不能让我的组件的CSS应用,我不知道为什么。我没有得到任何错误或任何东西。这可能来自我webpack.config.js,但我不知道。
Webpack.config.js VAR安可=要求( '@ symfony的/的WebPack-安可');
Encore
// the project directory where compiled assets will be stored
.setOutputPath('public/build/')
// the public path used by the web server to access the previous directory
.setPublicPath('/build')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
// uncomment to create hapshed filenames (e.g. app.abc123.css)
// .enableVersioning(Encore.isProduction())
// Provide global style
.addStyleEntry('css/index', './assets/css/index.scss')
.addStyleEntry('css/client', './assets/css/client.scss')
.addEntry('js/index', './assets/js/index.js')
.addEntry('js/client/index', './assets/js/client/index.js')
.addEntry('js/client/form', './assets/js/client/form.js')
.addEntry('js/manager/form', './assets/js/manager/form.js')
.addEntry('js/serviceProvider/form', './assets/js/serviceProvider/form.js')
.enableSassLoader()
// Use VueJS
.enableVueLoader()
.enableSassLoader()
.splitEntryChunks();
module.exports = Encore.getWebpackConfig();
零件:
<template>
<div>
<div class="row search-bar justify-content-start">
<h6 id="test" class="col-sm-12">Recherche</h6>
<filtering v-for="(filter, property) in search"
v-on:change="updateFilter"w
:type="filter.type"
:placeholder="filter.placeholder"
:key="property"
:options="filter.default"
:property="property">
</filtering>
</div>
<table class="table">
<tr :key="data.id" v-for="data in filteredData">
<slot v-bind:data="data">
<td>{{ data.id }}</td>
</slot>
</tr>
</table>
</div>
</template>
<style>
.search-bar{
background-color:red
}
</style>
<script>
...
</script>
比如在我的组件不应用规则background-color:red
据我所知,键入的代码后,你应该重新构建。尝试这个,
node_modules/.bin/encore dev