当前位置:网站首页>el-Select 选择器 底部固定
el-Select 选择器 底部固定
2022-08-04 04:43:00 【西小贝。】
需求:select 底部固定点击 滚动条直接到底部 展示input输入框


基本的引用element就不写了 直接写重点
HTML
<el-form-item label="名称:" prop="Name">
<el-select
ref="cascader" // 固定底部需要
v-model="sizeForm.parentTypeName"
class="select_mini"
placeholder="名称"
size="mini"
@visible-change="v => visibleChange(v, 'cascader', addCategory)"
>
<el-option
v-for="(item,index) in List"
:key="item.Code + index"
class="optionClass"
:label="item.TypeName"
:value="item.TypeCode"
>
<span class="check" />
<span style="margin-left: 8px">{
{ item.TypeName }}</span>
</el-option>
<div v-if="addCategoryValue" id="anchor">
<el-input v-model="sizeForm.parentName" placeholder="请输入内容"
size="mini" style="padding: 10px" />
<div style="text-align: right; padding-right: 10px">
<el-button class="btn_close" @click="addClose">取消</el-button>
<el-button type="primary" class="btn_save"
@click="addClickClose">确定</el-button>
</div>
</div>
</el-select>
</el-form-item>Js
visibleChange(visible, refName, onClick) {
if (visible) {
const ref = this.$refs[refName]
let popper = ref.$refs.popper
if (popper.$el) popper = popper.$el
if (!Array.from(popper.children).some(v => v.className === 'el-cascader-menu__list')) {
const el = document.createElement('ul')
el.className = 'el-cascader-menu__list'
el.style = 'border-top: solid 1px #E4E7ED; padding:0;color: #4f7bff;cursor: pointer;'
el.innerHTML = `<li class="el-cascader-node" style="height:38px;line-height: 38px">
<span class="el-cascader-node__label">+新增大类</span>
</li>`
popper.appendChild(el)
el.onclick = () => {
this.addCategoryValue = true
setTimeout(() => {
document.querySelector('#anchor').scrollIntoView(true)
}, 100) // 因为我控制隐藏是用的v-if 所以第一次进来获取不到才加的延时
}
}
}
},因为设计输入框是在select里面所以这样写 要是输入框放在外面可能需要在js里继续写样式 感兴趣的朋友可以尝试一下
到这里基本结束了 有问题留言
边栏推荐
- Explain detailed explanation and practice
- 【21 Days Learning Challenge】Direct Insertion Sort
- Shell 函数
- See how DevExpress enriches chart styles and how it empowers fund companies to innovate their business
- 8.Haproxy 搭建Web集群
- 10 Convolutional Neural Networks for Deep Learning 3
- System design. How to design a spike system (full version transfer)
- 【源码】使用深度学习训练一个游戏
- 基于 SSE 实现服务端消息主动推送解决方案
- 企业直播风起:目睹聚焦产品,微赞拥抱生态
猜你喜欢

Take care of JVM performance optimization (own note version)

文件系统的简单操作

7-3 LVS+Keepalived Cluster Description and Deployment

A Preliminary Study of RSS Subscription to WeChat Official Account-feed43

PL/SQL Some Advanced Fundamental

Enterprise live broadcast is on the rise: Witnessing focused products, micro-like embracing ecology

结构体指针知识要点总结

深度学习——以CNN服装图像分类为例,探讨怎样评价神经网络模型

42. 接雨水

JVM Notes
随机推荐
使用serve搭建本地服务器
【流程图】
【技巧】借助Sentinel实现请求的优先处理
软件测试如何系统规划学习呢?
Shell 函数
【机器学习】21天挑战赛学习笔记(一)
2022 software test interview questions The latest ByteDance 50 real interview questions, 15k have been won after brushing, with explanation + Q&A
3000字,一文带你搞懂机器学习!
Tensors - Application Cases
Postgresql源码(66)insert on conflict语法介绍与内核执行流程解析
redis中常见的面试题
There is an 8 hour difference between the docker installation of mysql and the host.
JVM笔记
数据治理平台项目总结和分析
如何简化现代电子采购的自动化?
Cache pool of unity framework
How to automatically export or capture abnormal login ip and logs in elastic to the database?
QT 如何识别文件的编码格式
初识Numpy
Introduction and application of go module