Bug Type: Component
Environment
- Vue Version:
3.3.4
- Element Plus Version:
2.3.1
- Browser / OS:
版本 114.0.5735.134(正式版本) (64 位)/ Windows
- Build Tool:
Webpack
Reproduction
Related Component
el-date-picker
Reproduction Link
Element Plus Playground
Steps to reproduce
hide
show
What is Expected?
v-show can work on
What is actually happening?
v-show not work on el-date-picker by switching radio
Additional comments
(empty)
2条答案
按热度按时间fnatzsnv1#
The reason should be that
el-tooltip
is used as theroot node
and thev-show
cannot be hung. As a temporary solution, it is recommended to wrap a layer ofdiv
outsideel-data-picker
.e1xvtsh32#
正如楼上说的,el-date-picker 本质上是el-tooltip包了一个el-input组件,el-tooltip会穿梭到最外面,剩下页面能看到的就是el-input组件,而el-input组件没有完全接受外层传入的属性,也就是没有v-bind="$attrs"这个,再加上本身他有v-show的判断。所以不能支持v-show
解决方案如下
1 自己业务中外层加个div控制
2 用v-if控制
3 让el官方大佬给你改源码,把属性层层传递到el-input上,然后进行合并判断即可