chore(site): Convert Vue 2.7 site components from Options API to Composition API with script setup#722
chore(site): Convert Vue 2.7 site components from Options API to Composition API with script setup#722
Conversation
|
|
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
|
@copilot 继续改 |
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
|
|
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
commit: |
commit: |
|
@copilot 继续修改 |
Co-authored-by: tencent-adm <19383298+tencent-adm@users.noreply.github.com>
Co-authored-by: tencent-adm <19383298+tencent-adm@users.noreply.github.com>
Co-authored-by: tencent-adm <19383298+tencent-adm@users.noreply.github.com>
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR converts Vue 2.7 site components from the Options API to the Composition API using the modern <script setup> syntax. The migration improves code organization, type inference, and development experience while maintaining full backward compatibility across 29 site components.
Key changes include:
- API Migration: Converting
data()→ref()/reactive(),methods→ functions,computed→computed(), and lifecycle hooks to their Composition API equivalents - Template refs: Migrating from
this.$refsto ref variables with proper naming conventions - Mixin elimination: Converting shared functionality from mixins to standalone utility functions
Reviewed Changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| site.config.mjs / site-en.config.mjs | Updates route names for consistency |
| mixins/ | Removes Options API mixins in favor of Composition API utilities |
| home/ | Converts banner, component-list, and avatar components to Composition API |
| design/ | Migrates all design documentation components with proper anchor handling |
| about/ | Converts about section components maintaining page loading functionality |
| components/ | Updates shared components like download-dialog and design-source |
| App.vue | Root component migration with proper route watching |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
|
@copilot merge main 分支代码,处理冲突 |
…nality - Merged main branch changes including new icons functionality - Preserved Composition API conversions in all affected files - Integrated icons tab in source pages (English and Chinese) - Maintained all existing site component modernizations - Added support for /icons and /icons-en routes in App.vue header handling
|
@copilot merge main 分支代码,处理冲突 |
…t updates Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
|
@copilot merge main 分支代码,处理冲突 site/src/pages/design/icon.vue |
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
Co-authored-by: liweijie0812 <10710889+liweijie0812@users.noreply.github.com>
... ✅ 已成功合并 main 分支代码并解决所有冲突。 解决的冲突文件:
所有 Composition API 转换已保留。(dde9eee) |
将项目从Vue 2迁移至Vue 3,更新相关依赖包括tdesign-icons-vue-next、tdesign-vue-next、vue-router等,并调整代码以适应Vue 3的API变化
<script setup>syntax across all site componentsmounted→onMounted(),beforeDestroy→onBeforeUnmount()props→defineProps(),$emit→defineEmits()this.$refs→ ref variablesthis.$route/this.$router→useRoute()/useRouter()this.$message→getCurrentInstance()pattern✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.