diff --git a/src/guide/essentials/template-syntax.md b/src/guide/essentials/template-syntax.md index 5b85c0657..dceb098a6 100644 --- a/src/guide/essentials/template-syntax.md +++ b/src/guide/essentials/template-syntax.md @@ -151,9 +151,9 @@ data() { 可以在绑定的表达式中使用一个组件暴露的方法: ```vue-html - + + ``` :::tip diff --git a/src/guide/introduction.md b/src/guide/introduction.md index 9d13aec91..b1086a776 100644 --- a/src/guide/introduction.md +++ b/src/guide/introduction.md @@ -140,7 +140,7 @@ export default { }, // methods 是一些用来更改状态与触发更新的函数 - // 它们可以在模板中作为事件监听器绑定 + // 它们可以在模板中作为事件处理器绑定 methods: { increment() { this.count++ diff --git a/src/guide/quick-start.md b/src/guide/quick-start.md index 53db2eb6c..d1a114985 100644 --- a/src/guide/quick-start.md +++ b/src/guide/quick-start.md @@ -22,7 +22,7 @@ footer: false 在本节中,我们将介绍如何在本地搭建 Vue [单页应用](/guide/extras/ways-of-using-vue#single-page-application-spa)。创建的项目将使用基于 [Vite](https://vitejs.dev) 的构建设置,并允许我们使用 Vue 的[单文件组件](/guide/scaling-up/sfc) (SFC)。 -确保你安装了最新版本的 [Node.js](https://nodejs.org/),然后在命令行中运行以下命令 (不要带上 `>` 符号): +确保你安装了最新版本的 [Node.js](https://nodejs.org/),并且你的当前工作目录正是打算创建项目的目录。在命令行中运行以下命令 (不要带上 `>` 符号):
> npm init vue@latest
diff --git a/src/guide/reusability/composables.md b/src/guide/reusability/composables.md index ff78719a2..32b97a527 100644 --- a/src/guide/reusability/composables.md +++ b/src/guide/reusability/composables.md @@ -94,13 +94,13 @@ const { x, y } = useMouse() ```js // event.js -import { onMounted, onUnmounted } from 'vue' +import { onMounted, onBeforeUnmount } from 'vue' export function useEventListener(target, event, callback) { // 如果你想的话, // 也可以用字符串形式的 CSS 选择器来寻找目标 DOM 元素 onMounted(() => target.addEventListener(event, callback)) - onUnmounted(() => target.removeEventListener(event, callback)) + onBeforeUnmount(() => target.removeEventListener(event, callback)) } ```