In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
这篇文章主要讲解了"如何理解VUE uni-app自定义组件",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"如何理解VUE uni-app自定义组件"吧!
1.父组件向子组件传递数据可以通过 props
2.子组件向父组件传递数据可以通过自定义事件,父组件自定义事件,子组件触发父组件的事件,并传传递数据
3.子组件可以定义插槽slot,让父组件自定义要显示的内容
4.使用easycom规范,可以真接使用组件
page/news/news.vue
自定义组件使用规范 黄色组件 export default { data() { return { } }, methods: { fclick(msg){ console.log('父组件收到子组件传递的值:'+msg); } } }
组件:components/card/card.vue
自定义组件 export default { name:"card", props:{ color:{ type:String, default:'white' } }, data() { return { }; }, methods:{ zclick(){ console.log('点了子组件'); this.$emit('fclick','定击事件传递给父组件'); } } }感谢各位的阅读,以上就是"如何理解VUE uni-app自定义组件"的内容了,经过本文的学习后,相信大家对如何理解VUE uni-app自定义组件这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!
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.