1. Create a components folder under the root directory to store components. Right click to create Components, four files WXML, WXSS, JS,json will be generated

(1) In json file (component created)

2. Open the wechat developer tool and create a Page in the Pages directory. Four files WXML, WXSS, JS and JSON will be generated

(1) Introduce components in JSON

(2) Write components in WXML

(3) The parent component passes the value to the child component: {{}} inside are the variables passed to the component

menuList="{{menuList}}"
Copy the code

(4) Sub-components receive and use

(5) The child component passes a value to the parent component, and the child component binds a method

(6) The parent component binds the method just broadcast by the child component

Reference links:Blog.csdn.net/hope93/arti…