当前位置:网站首页>微信小程序自定义组件
微信小程序自定义组件
2022-06-29 02:23:00 【hello php】
第一步:新建components目录
第二步:在components目录下新进一个目录,这里取名为myHeader
第三步:在myHeader目录上右键,在弹出的菜单中选择"新建Component",然后名称为myHeader,微信开发者工具会自动为你创建4个文件,分别为myHeader.js、myHeader.json、myHeader.wxml、myHeader.wxss,而且这个四个文件中都有默认的内容

其中myHeader.js中的内容是:
// components/myHeader/myHeader.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
myHeader.json文件的内容是:
{
"component": true,
"usingComponents": {}
}
myHeader.wxml文件的内容是:
<!--components/myHeader/myHeader.wxml-->
<text>components/myHeader/myHeader.wxml</text>
myHeader.wxss文件的内容是:
/* components/myHeader/myHeader.wxss */
自定义组件的使用:
边栏推荐
- 高并发的理解与设计方案
- 指南针手机股票开户哪个券商更安全更方便?
- How to become a senior digital IC Design Engineer (6-4) digital IC Verification: test point decomposition
- Finally got the byte offer. The 25-year-old inexperienced experience in software testing is written to you who are still confused
- "The first share of endoscope" broke into IPO two times. Last year, it lost 500million yuan. The commercialization of core products is still in doubt | IPO Express
- KOA Quick Start
- [redis] key hierarchy
- MySQL的下载和安装
- [apprendre la programmation FPGA - 49 à partir de zéro]: vision - Comment la puce a - t - elle été conçue?
- Project R & D, what are the free brain mapping tools that are easy to use
猜你喜欢

Handling method of occasional error reporting on overseas equipment

【Redis】Set类型

Mipi d-phy -- contents of HS and LP agreements

Boost the digital economy and face the future office | the launch of the new version of spreadjsv15.0 is about to begin
![[redis] get to know redis for the first time](/img/02/3c6a7f6ea8c563386a4cd458024728.png)
[redis] get to know redis for the first time

Introduction to openresty

【Redis】SortedSet类型

Talk about the copyonwritearraylist of JUC

Day10 enumeration class and annotation

Finally got the byte offer. The 25-year-old inexperienced experience in software testing is written to you who are still confused
随机推荐
三角函数计算
利用kubernetes資源鎖完成自己的HA應用
Introduction to openresty
MySQL的下载和安装
String substitution
Target detection - ADAS practice
字符串替换
Some tests on complementary wasm environment
跨境资讯站
Examen final de troisième année
请问etf基金是否靠谱,安全吗
Understanding and design of high concurrency
字符串分段组合
计算矩形面积
110. simple chat room 13: chat room server
The 10 most commonly used gadgets for waterfall project management can be built and used freely
HBuilder左侧工具栏不见了
网上联系客户经理办理炒股开户安全吗?
【网络通信学习笔记】Socket.IO的搭建和部署
Query any field of any table in JPA to the util method of entity class dto