当前位置:网站首页>第一个快应用(quickapp)demo
第一个快应用(quickapp)demo
2022-07-02 06:25:00 【android_Mr_夏】
简介
随着3月20号北京开发的快应用(quickapp)的发布,各大手机应用厂商加入了快应用这个行列,该应用模块以标准js语法+重组css标签+Flexbox布局+mvvm模式。类似于微信小程序的依附在微信中,而快应用依附在各大应用市场,可搜索直接打开,无需安装的便捷操作方式。
环境搭建(window平台)
- 安装nodejs(官网)。
- 安装hap-toolkit(打开cmd->npm install -g hap-toolkit)
- 安装完成输入命令(hap -V)
正确输出版本信息说明安装成功。例如(0.0.26)
二、初始化项目
1.执行以下命令初始化项目
hap init (你的项目名称)命令生成后,该目录的结构如下
├── node_modules
├── sign rpk包签名模块
│ └── debug 调试环境
│ ├── certificate.pem 证书文件
│ └── private.pem 私钥文件
├── src
│ ├── Common 公用的资源文件和组件文件
│ │ └── logo.png manifest.json中配置的icon
│ ├── Demo 页面目录
│ | └── index.ux 页面文件,文件名不必与父文件夹相同
│ ├── app.ux APP文件(用于包括公用资源)
│ └── manifest.json 项目配置文件(如:应用描述、接口申明、页面路由等)
└── package.json 定义项目需要的各种模块及配置信息,npm install根据这个配置文件,自动下载所需的运行和开发环境2.编译项目
先安装依赖,在项目根目录执行以下命令
npm install待安装完成,使用以下命令编译打包生成rpk包
npm run build编译打包成功后,项目根目录下会生成文件夹:build、dist
- build:临时产出,包含编译后的页面js,图片等
- dist:最终产出,包含rpk文件。其实是将build目录下的资源打包压缩为一个文件,后缀名为rpk,这个rpk文件就是项目编译后的最终产出
使用以下命令可自动重新编译,
npm run watch注意:

如果碰到上面的错误信息的话,我们可以通过命令hap update –force来解决此问题
三、调试
1.安装调试器
1.调试器是一个android应用,直接下载
2.按钮都不能点击,还需要再安装平台预览版
两个应用安装完就可以安装快应用了

2.安装运行rpk包
有两种方式:
* HTTP请求:开发者启动HTTP服务器,打开调试器,点击扫码安装配置HTTP服务器地址,下载rpk包,并唤起平台运行rpk包
* 本地安装:开发者将rpk包拷贝到手机文件系统,打开调试器,点击本地安装选择rpk包,并唤起平台运行rpk包
推荐第一种方式,调试比较方便。
http请求方式:
执行命令:
// 默认端口12306
npm run server
执行成功会显示二维码,可用调试器扫描二维码安装,或点击调试器右上角设置http服务器地址再点击在线更新。
此时配合命令npm run watch
“`
即可边开发边预览效果
3.所推荐使用的IDE
推荐的ide为vscode+hap extension插件开发,插件安装: 
推荐链接:
边栏推荐
- php中的二维数组去重
- Ceaspectuss shipping company shipping artificial intelligence products, anytime, anywhere container inspection and reporting to achieve cloud yard, shipping company intelligent digital container contr
- Basic knowledge of software testing
- 2021-07-05c /cad secondary development create arc (4)
- Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
- DNS attack details
- php中删除指定文件夹下的内容
- Common prototype methods of JS array
- Flex Jiugongge layout
- 2021-07-17c /cad secondary development creation circle (5)
猜你喜欢

JSP智能小区物业管理系统

Analysis of MapReduce and yarn principles

类加载器及双亲委派机制

Flex Jiugongge layout

Build FRP for intranet penetration

SQL injection closure judgment

Recursion (maze problem, Queen 8 problem)

Brief analysis of PHP session principle

图解Kubernetes中的etcd的访问

UEditor . Net version arbitrary file upload vulnerability recurrence
随机推荐
js判断对象是否为空
SQLI-LABS通关(less15-less17)
php中根据数字月份返回月份的英文缩写
ssm超市订单管理系统
Explanation and application of annotation and reflection
JS to determine whether there is a value in the object in the array
oracle apex ajax process + dy 校验
ORACLE 11G利用 ORDS+pljson来实现json_table 效果
中年人的认知科普
ORACLE APEX 21.2安装及一键部署
Common prototype methods of JS array
Sqli labs customs clearance summary-page4
MySQL index
SQLI-LABS通关(less18-less20)
数仓模型事实表模型设计
MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
Network security -- intrusion detection of emergency response
Sqli - Labs Clearance (less6 - less14)
Oracle segment advisor, how to deal with row link row migration, reduce high water level
The boss said: whoever wants to use double to define the amount of goods, just pack up and go