Pages/how many/index. WXML (how) components/article – item/index WXML (hereinafter referred to as articleList) how use articleList components, How does the articleList component get the articelList array passed from Recommend?

1. Pass parameters through attributes where components are used

<! --pages/recommend/index.wxml--><view>
  <my-article-list articleList="{{articleList}}" msg="{{msg}}"></my-article-list>
</view>
Copy the code

2. Where the component is defined, find the corresponding JS file and receive it via Properties

// components/article-list/index.js
Component({
  properties: {msg: {type:String.value:' '
    },
    articleList: {type:Array.value: []}}})Copy the code

3. Use this property in the component template file

<! --components/article-list/index.wxml--><view>
  <block wx:for="{{articleList}}" wx:key="user_id">
    <my-article-item articleItem="{{item}}" msg="{{msg}}"></my-article-item>
  </block>
</view>
Copy the code

Wechat small program introduction:

1. Component communication

2. Life cycle

3. External style classes

4. Customize attributes

5, events,

6, variables,