简体   繁体   English

Popper关闭时的ElementUI日期时间选择器更新

[英]ElementUI datetime picker update on popper close

I'm using ElementUI with Vue.js. 我在Vue.js中使用ElementUI。

What I want to do is to use el-date-picker and listen for the update of the input only when the picker's popper closes (so earlier updates when selecting date via mouse click / direct text edit or via keyboard arrow controls won't trigger my 'special' update) - is it easily achievable? 我想做的是仅在选择器的弹出器关闭时使用el-date-picker并监听输入的更新(因此,通过鼠标单击/直接文本编辑或通过键盘箭头控件选择日期时,较早的更新不会触发我的“特殊”更新)-是否可以轻松实现? I was thinking of using custom popper class but not sure how to listen for close event to detect it. 我当时在考虑使用自定义popper类,但不确定如何监听close事件来检测它。

You can achieve what you want with the blur event : https://element.eleme.io/#/en-US/component/date-picker#events 您可以使用blur事件来实现所需的目标: https : //element.eleme.io/#/en-US/component/date-picker#events

Here is a Codepen if you want to play with it. 如果您想使用它,这里是一个Codepen And here is the code if you just want to run it : 如果您只想运行它,这是代码:

 var Main = { methods: { blur () { console.log('hey') } }, data() { return { value1: '' }; } }; var Ctor = Vue.extend(Main) new Ctor().$mount('#app') 
 @import url("//unpkg.com/element-ui@2.8.2/lib/theme-chalk/index.css"); 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <script src="//unpkg.com/vue/dist/vue.js"></script> <script src="//unpkg.com/element-ui@2.8.2/lib/index.js"></script> <div id="app"> <template> <div class="block"> <span class="demonstration">Default</span> <el-date-picker v-model="value1" type="date" @blur="blur" placeholder="Pick a day"> </el-date-picker> </div> </template> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM