Component passing value for small program component development

The components of the applet actually encapsulate the common code on the page to reduce code redundancy

The data in the component is also passed through the page. Here are the steps:

1. Fill in the required data in the js of the page

2. In the wxml file of the page, pass the data to the component

3. The key step is to declare variables in the component js file, properties is to declare data variables passed from outside, and data is the data needed in the component

4. Render the data in the component, note that there is no need to add the <block> tag here

Guess you like

Origin blog.csdn.net/xiaoyun888_/article/details/109514734