Applet to create custom components

Create a directory components, put the file below

1, create a test component

//     test.wxml 
<View> title </ View> 
<View> contents contents </ View> //     test.json {
   " Component " : to true ,
   " usingComponents " : {} 
}

2, page which reference component

//     introduced locally incorporated components 
{
   " usingComponents " : {
     " Test " : " / Components / Test / Test " 
  } 
} 
//     global introduction, in which app.json 
usingComonents: {
      " Test " : " / Components / Test / Test " 
} 
//     directly displayed, either of which can 
  <Test /> 
  <Test> </ Test>

 

Custom component and page class name the same name, is no conflict;
Page class and custom components in class the same name; same do not conflict;
 

Guess you like

Origin www.cnblogs.com/webfy/p/11521478.html