小程序使用wepy开发(一)

安装wepy

  1. 安装 wepy 命令行工具(-g 表示全局)
npm install -g wepy-cli
wepy -v
#查看wepy版本
  1. 开发目录中生成Demo开发项目
wepy new myproject
# 1.7.0之后的版本使用 wepy init standard myproject 初始化项目,使用 wepy list 查看项目模板
  1. 切换至项目目录
cd myproject
  1. 安装依赖
npm  install
  1. 开启实时编译
wepy build --watch

看到这个,就已经成功了
在这里插入图片描述
6. 开发工具打开
在这里插入图片描述

  1. WePY项目的目录结构
├── dist                   小程序运行代码目录(该目录由WePY的build指令自动编译生成,请不要直接修改该目录下的文件)
├── node_modules           
├── src                    代码编写的目录(该目录为使用WePY后的开发目录)
|   ├── components         WePY组件目录(组件不属于完整页面,仅供完整页面或其他组件引用)
|   |   ├── com_a.wpy      可复用的WePY组件a
|   |   └── com_b.wpy      可复用的WePY组件b
|   ├── pages              WePY页面目录(属于完整页面)
|   |   ├── index.wpy      index页面(经build后,会在dist目录下的pages目录生成index.js、index.json、index.wxml和index.wxss文件)
|   |   └── other.wpy      other页面(经build后,会在dist目录下的pages目录生成other.js、other.json、other.wxml和other.wxss文件)
|   └── app.wpy            小程序配置项(全局数据、样式、声明钩子等;经build后,会在dist目录下生成app.js、app.json和app.wxss文件)
└── package.json           项目的package配置
发布了75 篇原创文章 · 获赞 12 · 访问量 3453

猜你喜欢

转载自blog.csdn.net/weixin_44737877/article/details/103196810