需求描述
需要修改某一个页面(组件)的弹框,又不能影响其他组件的弹框样式
然而不能在<style scoped></style>中直接修改,因为不生效
也不能在<style></style>中修改,因为会影响其他组件
方法
在弹框样式外面再套一个div,使用vue深度选择器。
<div class="wrapper">
<el-dialog class="pop_dialog" title="" :visible.sync="wuhan" width="35%"
center show-close="false" height="100%">
<!-- <el-image-->
<!-- style="width: 240px; height: 380px"-->
<!-- :src="url"-->
<!-- :fit="fill">-->
<!-- </el-image>-->
<vue-typed-js :strings="['Welcome to my Vue.js blog','Enjoy yourself']"
:typeSpeed="100" :loop="true" @onComplete="doSmth()">
<h1 class="typing">
</h1>
</vue-typed-js>
<!-- <span slot="footer" class="dialog-footer">-->
<!-- <el-button @click="wuhan=f alse">取 消</el-button>-->
<!-- <el-button type="primary" @click="wuhan=f alse">确 定</el-button>-->
<!-- </span>-->
</el-dialog>
</div>
<style scoped>
.wrapper >>> .el-dialog__body {
background-color: black !important;
color: black;
height: 100%;
}
.wrapper >>> .el-dialog__header {
background: black;
}
</style>