In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
这篇"vue组件怎么实现弹出框点击显示隐藏效果"文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇"vue组件怎么实现弹出框点击显示隐藏效果"文章吧。
效果如下图
由于我的更改密码弹出框是一个组件引用的,所以在一开始是隐藏的,这就需要在当前的页面上对弹出框组件设置v-show,但是在弹出框显示出来的时候,操作执行完后当前页面的更改按钮已经被弹出框覆盖了。所以只能在弹出页面点击取消实现关闭隐藏弹出框。这样就需要写两个点击事件,但是两个点击事件就会有冲突,需要点击两下才能使弹出框显示和隐藏。然后我就用的以下方法,希望可以帮到大家!!!
代码如下
1.在当前页面中(主页面)
...... 更改密码 //点击事件 ...... //组件传一个点击事件@hidden="hiddenShow",而这个点击事件就是下面的hiddenShow()函数 //调用组件 import ModifyPassword from '@/components/pop-up/ModifyPassword.vue //引入组件 export default { data(){ return{ date:'', ModifyPassword_pop_up:false, history_pop_up:false } }, components:{ ModifyPassword //引用组件 }, methods:{ //更改密码弹出框显示(组件引用的弹出框) ModifyPassword(){ this.ModifyPassword_pop_up=true }, //更改密码弹出框隐藏(传给组件一个点击事件) hiddenShow(){ let that = this; that.ModifyPassword_pop_up = false } } }
2.在弹出框组件页面中(更改密码)
...... //在取消按钮这里调用点击事件 ...... export default { data(){ return{} }, methods:{ //本更改密码弹出框的显示隐藏事件 Hidden(){ //通过$emit引用组件传过来的hidden()事件 this.$emit('hidden') } } }以上就是关于"vue组件怎么实现弹出框点击显示隐藏效果"这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注行业资讯频道。
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.