The difference between applet template and component of

1. applet template template can not write the event, neither the js file

Components component is a custom event, and the component has its own life cycle
2, a different way of introduction to the page
.wxml introduced directly in the template page <import src = 'components / menu / menu.wxml' />
Where it is needed with the write
<template is="menu" data="{{icons, iconsSwitch, iconBg}}">
</template>
 
component was introduced in .json file corresponding page
"usingComponents": {
"banner": "../../../components/banner/banner"
}
The time needed to write the page
<banner layoutID="{{commpent.LayoutID}}" typeID="{{commpent.TypeID}}"></banner>
 

Guess you like

Origin www.cnblogs.com/ouyangxiaoyao/p/11613613.html