当前位置:网站首页>微信小程序自定义组件
微信小程序自定义组件
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 */
自定义组件的使用:
边栏推荐
- String method exercise
- The left toolbar of hbuilder is missing
- Trigonometric function calculation
- How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script
- To apply for a test engineer after years, the resume with high scores should be written like this
- Utiliser kubernets Resource Lock pour compléter son application ha
- 跨境资讯站
- Written examination questions, answers and analysis of Digital IC design and FPGA design (2) 2021 Huawei Hisilicon (Part 1)
- Which securities company is the largest and safest? Which securities company has good service
- CTFHub-Web-密码口令-默认口令
猜你喜欢

Introduction to openresty

Sysbench Pressure Test Oracle (installation and use examples)

SystemVerilog structure (I)

China's flexible employment has reached 200million

What is Mipi

2022.02.15

Koa 快速入门

How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script

【Redis】SortedSet类型

【Redis】Hash类型
随机推荐
三角函数计算
Tiflash compiler oriented automatic vectorization acceleration
e.target与e.currentTarget的区别
Kubernetes: container resource requirements and constraints (constraints)
table通过伪类实现 另类自适应
学习太极创客 — MQTT 第二章(九)本章测试
Why is it recommended that you choose the self research company as much as possible
How to become a senior digital IC Design Engineer (6-7) digital IC Verification: debug skills
指南针手机股票开户哪个券商更安全更方便?
温度转换 II
How to become a senior digital IC Design Engineer (5-1) theory: clock technology, reset Technology
字符串输出
[redis] set type
【学习笔记】子集和问题
Com3529 test analysis
Is it safe to contact the account manager online to open an account for stock speculation?
Use kubernetes resource lock to complete your own ha application
计算矩形面积
Which is the best billing method for okcc call center
The 10 most commonly used gadgets for waterfall project management can be built and used freely