当前位置:网站首页>微信小程序自定义组件
微信小程序自定义组件
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 */
自定义组件的使用:
边栏推荐
- Boost the digital economy and face the future office | the launch of the new version of spreadjsv15.0 is about to begin
- 目标检测——ADAS实战
- Dialogue with opensea co creation Alex: we still only touch the tip of the iceberg of NFT capability | chain catcher
- 【Redis】初识 Redis
- Learning Tai Chi Maker - mqtt Chapter II (IX) test of this chapter
- 大智慧手机股票开户哪个券商更安全更方便?
- 字符串属性练习
- Some tests on complementary wasm environment
- Why install an SSL certificate on a web site?
- [redis] set type
猜你喜欢

Download and installation of MySQL

Some tests on complementary wasm environment

【Redis】Set类型

Flex application: realize two rows and five columns of data, self-adaptive

Configurable FFT system design based on risc-v SOC (1) Introduction

SAP ui5 beginner tutorial 22 - development and use of filter

Ctfhub web password weak password
![[redis] data introduction & General Command & string type](/img/86/3abc5047f9c0a051f432e82ccc816c.png)
[redis] data introduction & General Command & string type

HBuilder左侧工具栏不见了

OpenResty 使用介绍
随机推荐
大三下期末考试
The left toolbar of hbuilder is missing
Necessary technologies for chip manufacturers (1) Introduction
在按钮禁用时消除hover效果
"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
[high concurrency, high performance and high availability of massive data MySQL practice-10] - Implementation of mvcc in InnoDB
干货丨微服务架构是什么?有哪些优点和不足?
Ctfhub web password default password
Is it safe to contact the account manager online to open an account for stock speculation?
Learning Tai Chi Maker - mqtt Chapter II (IX) test of this chapter
Cross border information station
Handling method of occasional error reporting on overseas equipment
【Redis】数据介绍 & 通用命令 & String类型
Which is the best billing method for okcc call center
Some tests on complementary wasm environment
跨境资讯站
Understanding and design of high concurrency
Why should the pointer be null after delete
How to become a senior digital IC Design Engineer (3-5) tools: Spyglass Technology
对补wasm环境的一些测试