<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Component on Coding</title>
		<link>http://coding.dong.asia/tags/component/</link>
		<description>Recent content in Component on Coding</description>
		<generator>Hugo</generator>
		<language>cn</language>
		
		
		
			<copyright>京ICP备17034023号 © 2019 隨風揚</copyright>
		
		
			<lastBuildDate>Wed, 15 Apr 2020 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="http://coding.dong.asia/tags/component/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>小程序子组件列表下拉刷新</title>
				<link>http://coding.dong.asia/wechat/refresh/</link>
				<pubDate>Wed, 15 Apr 2020 00:00:00 +0000</pubDate>
				<guid>http://coding.dong.asia/wechat/refresh/</guid>
				<description>&lt;p&gt;最近，研究小程序的过程中，遇到一个问题：小程序的组件Component并没有的Page下拉监听事件：&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;onPullDownRefresh&#x9;监听用户下拉动作&lt;/li&gt;&#xA;&lt;li&gt;onReachBottom&#x9;页面上拉触底事件的处理函数&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;比如说，下面这样的结构：&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;index page 引用search-head组件&lt;/li&gt;&#xA;&lt;li&gt;search-head component 引用search-list组件&lt;/li&gt;&#xA;&lt;li&gt;search-list component 显示列表数据&#xA;&lt;img src=&#34;http://media.guoj.top/wechat/refresh.png&#34; alt=&#34;&#34;&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;那如何才能刷新组件的列表呢：&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;search-head提供搜索、翻页方法，传递数据给search-list。&lt;/li&gt;&#xA;&lt;li&gt;search-list组件只显示数据。&lt;/li&gt;&#xA;&lt;li&gt;page监听&lt;code&gt;onReachBottom&lt;/code&gt;事件，然后调用search-head中的方法。&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;search-head&#34;&gt;search-head&lt;/h2&gt;&#xA;&lt;p&gt;搜索头部组件，此组件内引用搜索列表组件。在这个组件内，实现搜索、翻页功能。通过组件将数据传递给子组件。&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
