From 94bc6d7d8974069c6c139856563bde40ad6af628 Mon Sep 17 00:00:00 2001 From: Wh0ami-hy <81816859+Wh0ami-hy@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:24:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _posts/.obsidian/workspace.json | 19 ++++++------- _posts/2023-12-30-node.md | 4 +-- ...00\345\217\221\345\256\236\350\267\265.md" | 27 +++++++++++++++++++ 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 "_posts/2024-09-10-Taro\345\274\200\345\217\221\345\256\236\350\267\265.md" diff --git a/_posts/.obsidian/workspace.json b/_posts/.obsidian/workspace.json index c85c091..232b122 100644 --- a/_posts/.obsidian/workspace.json +++ b/_posts/.obsidian/workspace.json @@ -13,7 +13,7 @@ "state": { "type": "markdown", "state": { - "file": "2023-12-30-node.md", + "file": "2023-12-30-Node.md", "mode": "source", "source": false } @@ -48,7 +48,7 @@ "state": { "type": "search", "state": { - "query": "", + "query": "file:node", "matchingCase": false, "explainSearch": false, "collapseAll": false, @@ -70,8 +70,7 @@ } ], "direction": "horizontal", - "width": 300, - "collapsed": true + "width": 300 }, "right": { "id": "d508948902057409", @@ -87,7 +86,7 @@ "state": { "type": "backlink", "state": { - "file": "2023-12-30-node.md", + "file": "2023-12-30-Node.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -104,7 +103,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "2023-12-30-node.md", + "file": "2023-12-30-Node.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -139,7 +138,7 @@ "state": { "type": "outline", "state": { - "file": "2023-12-30-node.md" + "file": "2023-12-30-Node.md" } } } @@ -160,10 +159,12 @@ "command-palette:Open command palette": false } }, - "active": "484e8eca18f08b6b", + "active": "14da16911b35c692", "lastOpenFiles": [ - "2024-09-09-前端框架中的状态管理.md", + "2024-09-10-Taro开发实践.md", "2024-08-30-React最佳实践.md", + "2023-12-30-node.md", + "2024-09-09-前端框架中的状态管理.md", "2024-02-07-Vue项目结构.md", "2024-03-24-Quasar开发总结.md", "2024-08-26-React入门.md", diff --git a/_posts/2023-12-30-node.md b/_posts/2023-12-30-node.md index 7653dd5..399c230 100644 --- a/_posts/2023-12-30-node.md +++ b/_posts/2023-12-30-node.md @@ -2,7 +2,7 @@ layout: post catalog: true tags: - - node + - Node --- @@ -89,7 +89,7 @@ npm install xxx 利用 npm 安装xxx依赖到当前命令行所在目录 npm install xxx -g 利用npm安装全局依赖xxx npm install xxx –save 安装并写入package.json的”dependencies”中 npm install xxx –save-dev 安装并写入package.json的”devDependencies”中 -  + **npm删除依赖** npm uninstall xxx 删除xxx依赖 npm uninstall xxx -g 删除全局依赖xxx \ No newline at end of file diff --git "a/_posts/2024-09-10-Taro\345\274\200\345\217\221\345\256\236\350\267\265.md" "b/_posts/2024-09-10-Taro\345\274\200\345\217\221\345\256\236\350\267\265.md" new file mode 100644 index 0000000..7017b29 --- /dev/null +++ "b/_posts/2024-09-10-Taro\345\274\200\345\217\221\345\256\236\350\267\265.md" @@ -0,0 +1,27 @@ +--- +layout: post +catalog: true +tags: + - Taro + +--- + +# 1. 概念 + + Taro 在组件、API、路由等规范上,遵循微信小程序规范,所以在 Taro 中使用 React 和开发者熟悉的 Web 端有一些差异 + +因为在 Taro 3 中开发者使用的是真实的 React,React 的 API 如 `Component`、`useState`、`useEffect` 等都需要从 React 包中获取。 + +从 Taro v3.5 开始,Taro 将默认使用 React 18 版本 + +``` +// 从 'react' 包中获取 React API +import React, { Component, useState, useEffect } from 'react' +``` + +UI组件使用Taro UI +# 2. 入口组件和页面组件 + +因为 Taro 遵循小程序的路由规范,所以引入了入口组件和页面组件的概念,分别对应小程序规范的入口组件 `app` 和页面组件 `page`。 + +一个 Taro 应用由一个入口组件和至少一个页面组件所组成。 \ No newline at end of file