vuejs / vuejs/docs

建议:建议在基础分类-响应式基础中添加对 <script setup>的对比说明

Open
#3,246 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vue
Stars
3.2k
Forks
5k
Avg merge
14d 17h
Merged PRs (30d)
1

Description

https://cn.vuejs.org/guide/essentials/reactivity-fundamentals#script-setup

现状:缺少对选项式的用法示例。

建议在这个位置添加选项式用法示例和组合式的用法示例。
这样新手在阅读文档的时候,可以通过两种方式对比理解<script setup>的优势和原理,有助于更好理解框架本身的意图。
建议使用下面的方式列举出优缺点。

下面的内容来自Deepseek生成

传统写法痛点 <script setup> 解决方案
需手动返回模板使用的变量 顶层变量自动暴露
组件需在 components 注册 导入即自动注册
props/emits 声明分离 使用 defineProps/defineEmits 集中声明
逻辑关注点分散在多个选项 所有代码按功能组织(非选项分割)
this 上下文问题 无 this,纯函数式编程

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the linked Reactivity Fundamentals page and review the existing <script setup> explanation and examples. Add contrasting Options API and Composition API usage examples with an accurate, concise comparison of their trade-offs, then verify the rendered documentation and links.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.