网站首页 > 技术文章 正文
- 代码: https://github.com/ikuokuo/start-taro
前提准备
yarn global add @tarojs/cli
创建项目
taro init my-app
输出信息:
Taro v3.0.16
Taro 即将创建一个新项目!
Need help? Go and open issue: https://tls.jd.com/taro-issue-helper
? 请输入项目介绍!
? 请选择框架 React
? 是否需要使用 TypeScript ? Yes
? 请选择 CSS 预处理器(Sass/Less/Stylus) Sass
? 请选择模板源 Gitee(最快)
? 拉取远程模板仓库成功!
? 请选择模板 taro-ui
? 创建项目: my-app
...
? cd my-app, 执行 git init
? 安装成功
...
创建项目 my-app 成功!
请进入项目目录 my-app 开始工作吧!
运行程序
微信小程序
下载并打开微信开发者工具,然后导入 my-app 项目:
编译预览:
? yarn dev:weapp
yarn run v1.22.10
nbsp;npm run build:weapp -- --watch
npm WARN lifecycle The node binary used for scripts is /var/folders/d3/gg88014s28j41dgh6dznfp7h0000gn/T/yarn--1605187598317-0.7594031278537579/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> my-app@1.0.0 build:weapp /Users/ikuokuo/start-taro/my-app
> taro build --type weapp "--watch"
Taro v3.0.16
Tips: 预览模式生成的文件较大,设置 NODE_ENV 为 production 可以开启压缩。
Example:
nbsp;NODE_ENV=production taro build --type weapp --watch
生成 工具配置 /Users/ikuokuo/start-taro/my-app/dist/project.config.json
编译 发现入口 src/app.ts
编译 发现页面 src/pages/index/index.tsx
? 编译成功
监听文件修改中...
编译打包:
? yarn build:weapp
yarn run v1.22.10
nbsp;taro build --type weapp
Taro v3.0.16
生成 工具配置 /Users/ikuokuo/start-taro/my-app/dist/project.config.json
编译 发现入口 src/app.ts
编译 发现页面 src/pages/index/index.tsx
? 编译成功
Hash: 3e1757774efcf01a6850
Version: webpack 4.42.0
Time: 6089ms
Built at: 11/12/2020 9:46:51 PM
Asset Size Chunks Chunk Names
app.js 77 KiB 3 [emitted] app
app.js.LICENSE.txt 500 bytes [emitted]
app.json 177 bytes [emitted]
app.wxss 0 bytes 3 [emitted] app
base.wxml 66.9 KiB [emitted]
comp.js 72 bytes 5 [emitted] comp
comp.json 54 bytes [emitted]
comp.wxml 84 bytes [emitted]
pages/index/index.js 150 KiB 6 [emitted] pages/index/index
pages/index/index.js.LICENSE.txt 1.21 KiB [emitted]
pages/index/index.json 71 bytes [emitted]
pages/index/index.wxml 82 bytes [emitted]
pages/index/index.wxss 1.44 KiB 6 [emitted] pages/index/index
runtime.js 1.46 KiB 0 [emitted] runtime
taro.js 94.4 KiB 1 [emitted] taro
utils.wxs 981 bytes [emitted]
vendors.js 13.5 KiB 2 [emitted] vendors
vendors.js.LICENSE.txt 295 bytes [emitted]
Entrypoint app.config = runtime.js
Entrypoint pages/index/index.config = runtime.js
Entrypoint app = runtime.js taro.js vendors.js app.wxss app.js
Entrypoint comp = runtime.js taro.js vendors.js comp.js
Entrypoint pages/index/index = runtime.js taro.js vendors.js pages/index/index.wxss pages/index/index.js
? Done in 11.08s.
基础教程
根据创建项目时的选择,继续阅读教程。例如本文的选择,请阅读:
- React
- Taro UI
参考
- taro
- Taro Docs
- Taro UI
结语
欢迎关注 GoCoding 公众号,分享日常 Coding 中实用的小技巧、小知识!
猜你喜欢
- 2024-12-02 Zustand 和 Jotai 作者前端新框架 Waku 来了
- 2024-12-02 Web3系列教程之进阶篇——11. The Graph索引协议
- 2024-12-02 Vue 3最常用函数(备忘查询)
- 2024-12-02 前端新一代框架 Svelte 火了!十个场景带你简单认识它!
- 2024-12-02 使用vue-cli(vue脚手架)快速搭建项目
- 2024-12-02 深入讲解VsCode各场景高级调试与使用技巧
- 2024-12-02 基于小程序 DSL(微信、支付宝)的,可扩展的多端研发框架
- 2024-12-02 如何使用Tailwind CSS轻松设计惊艳的进度条
- 2024-12-02 Tailwind CSS 小案例,创建漂亮的购物车卡片
- 2024-12-02 万字详文:彻底搞懂 Jest 单元测试框架
- 1509℃桌面软件开发新体验!用 Blazor Hybrid 打造简洁高效的视频处理工具
- 530℃Dify工具使用全场景:dify-sandbox沙盒的原理(源码篇·第2期)
- 493℃MySQL service启动脚本浅析(r12笔记第59天)
- 473℃服务器异常重启,导致mysql启动失败,问题解决过程记录
- 470℃启用MySQL查询缓存(mysql8.0查询缓存)
- 451℃「赵强老师」MySQL的闪回(赵强iso是哪个大学毕业的)
- 430℃mysql服务怎么启动和关闭?(mysql服务怎么启动和关闭)
- 427℃MySQL server PID file could not be found!失败
- 最近发表
- 标签列表
-
- c++中::是什么意思 (83)
- 标签用于 (65)
- 主键只能有一个吗 (66)
- c#console.writeline不显示 (75)
- pythoncase语句 (81)
- es6includes (73)
- windowsscripthost (67)
- apt-getinstall-y (86)
- node_modules怎么生成 (76)
- chromepost (65)
- c++int转char (75)
- static函数和普通函数 (76)
- el-date-picker开始日期早于结束日期 (70)
- js判断是否是json字符串 (67)
- checkout-b (67)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- & (66)
- java (73)
- js数组插入 (83)
- linux删除一个文件夹 (65)
- mac安装java (72)
- eacces (67)
- 查看mysql是否启动 (70)
- 无效的列索引 (74)