当前位置:网站首页>微信小程序自定义组件
微信小程序自定义组件
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 */
自定义组件的使用:
边栏推荐
- Use code binding DataGridView control to display tables in program interface
- Qt基础教程:数据类型与容器
- The 10 most commonly used gadgets for waterfall project management can be built and used freely
- 【Redis】Key的层级结构
- OpenResty 使用介绍
- Finally got the byte offer. The 25-year-old inexperienced experience in software testing is written to you who are still confused
- Junior final exam
- [learn FPGA programming from scratch -49]: Vision - how is the chip designed?
- B1009 irony
- Written examination questions, answers and analysis of Digital IC design and FPGA design (2) 2021 Huawei Hisilicon (Part 1)
猜你喜欢
随机推荐
Ctfhub web password default password
对补wasm环境的一些测试
Is it safe to contact the account manager online to open an account for stock speculation?
Sysbench Pressure Test Oracle (installation and use examples)
基于 RISC-V SoC 的可配置 FFT 系统设计(1)引言
RISC CPU design based on FPGA (4) 36 questions about the project and their answers
Qt基础教程:QStringList
How to become a senior digital IC Design Engineer (6-7) digital IC Verification: debug skills
String substitution
How to become a senior digital IC Design Engineer (1-1) Verilog coding Grammar: Introduction
Query any field of any table in JPA to the util method of entity class dto
e.target与e.currentTarget的区别
Which is the best billing method for okcc call center
Blog publishing test 3
How to become a senior digital IC Design Engineer (5-1) theory: clock technology, reset Technology
为什么要在网站上安装SSL证书?
Com3529 test analysis
【Redis】List类型
Examen final de troisième année
Koa 快速入門









