小程序中组件的使用
1.一般组件需要定义一个文件夹,文件夹命名为components
2.文件夹下可以定义一个需要引用的组件
3.文件夹下包含4个文件分别是js、json、wxml、wxss。
4.控制组件的显示与隐藏通过hidden来控制,true为隐藏,false为显示
5.注意:需要在json文件中定义两个属性:
{
"component": true,
"usingComponents": {}
}
组件在小程序中的使用方法如下:
在需要引用的页面json文件中写入:
"usingComponents": {
"loadmore": "/components/loadmore/loadmore"
}