zl程序教程

您现在的位置是:首页 >  工具

当前栏目

vscode vant 样式覆盖、自定义样式 dropdown-menu-content-max-height

VSCode 自定义 样式 覆盖 max content Menu height
2023-09-11 14:21:27 时间

 

@dropdown-menu-content-max-height 默认是80%,想改成100%

官方文档太复杂,不太懂:https://vant-contrib.gitee.io/vant/#/zh-CN/dropdown-menu

仅改css怎么弄?

加scoped则失效

<style scoped>

 .my-dropdown-menu .van-dropdown-item__content {
    position: absolute;
    max-height: 100% !important;
 }
 

</style>

去掉scoped,会影响全局页面。需要加上class类名称,控制作用域。

<style>

 .my-dropdown-menu .van-dropdown-item__content {
    position: absolute;
    max-height: 100% !important;
 }
 

</style>

  应用:

    <van-dropdown-menu active-color="rgb(4,190,2)" duration="0" class="my-dropdown-menu" >
        <van-dropdown-item v-model="stationType" :options="stationTypeList2" />
        <van-dropdown-item v-model="displayType" :options="displayTypeList2" />
        <van-dropdown-item title="筛选" ref="item"  >   
            <div>
               
                    <div style="padding: 5px 16px 10px 16px">
                        <van-button type="primary" block round @click="searchClick">
                            确认
                        </van-button>
                    </div>
              
            </div>
        </van-dropdown-item>      
    </van-dropdown-menu>