feat: add Loading component for vue#330
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new Loading component to the Vue package, including its styles, types, demo pages, and registration in the component registry.
- Added
Loading.vue, type definitions, style sheets, and demo markdowns - Registered the component in
style.tsandcomponents.ts - Documented props and usage in README files
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| components/style.ts | Imported loading styles |
| components/loading/type.ts | Defined LoadingProps and LoadingRef |
| components/loading/style/index.ts | Added style entry point |
| components/loading/style/index.less | Implemented loading LESS rules |
| components/loading/index.ts | Created install wrapper |
| components/loading/demo/*.md | Added demos (basic, filleted, custom) |
| components/loading/README.md & README.en-US.md | Documented component API |
| components/loading/Loading.vue | Implemented Loading logic and template |
| components/components.ts | Registered loading in registry |
Comments suppressed due to low confidence (2)
packages/arcodesign-vue/components/loading/type.ts:16
- [nitpick] Using
classas a prop name may conflict with the HTMLclassattribute and can be confusing. Consider renaming it tocustomClassorclassNamefor clarity.
class?: string;
packages/arcodesign-vue/components/loading/README.md:19
- The
listprop dynamically defaults based ontypebut the README shows-as its default. Consider documenting the auto-generated default values for clarity.
| list | 当类型为`dot`或`spin`时有效,定义内部各元素的透明度 | number\[\] | - |
| &.line { | ||
| width: 100%; | ||
|
|
||
| .loading-line-start, | ||
| .loading-line-end { | ||
| .use-var(stop-color, loading-color); | ||
| } | ||
|
|
||
| .loading-line-start { | ||
| stop-opacity: 0; | ||
| } | ||
| } |
There was a problem hiding this comment.
The .line selector is never used because LoadingType does not include a line type. Consider removing this block to avoid dead code.
| &.line { | |
| width: 100%; | |
| .loading-line-start, | |
| .loading-line-end { | |
| .use-var(stop-color, loading-color); | |
| } | |
| .loading-line-start { | |
| stop-opacity: 0; | |
| } | |
| } | |
| // Removed the `.line` block as it is unused and considered dead code. |
| const actualSvgKey = computed(() => props.svgKey || `${Date.now()}-${Math.random()}`); | ||
|
|
||
| // 获取样式与浏览器前缀 | ||
| function getStyleWithVendor(style: Record<string, any>) { |
There was a problem hiding this comment.
The getStyleWithVendor function currently just returns the input style. Either implement vendor-prefix logic here or remove this stub to simplify the code.
| watch([() => props.list, () => props.type], () => { | ||
| stopAnimation(); | ||
| initStatusList(); | ||
| startAnimation(); | ||
| }); | ||
|
|
||
| watch([() => props.type, () => statusList.value, () => props.duration], () => { | ||
| stopAnimation(); | ||
| startAnimation(); | ||
| }); |
There was a problem hiding this comment.
There are two separate watchers restarting the animation; these can trigger redundant intervals. Consider combining them into one watcher or extracting a single restart handler.
| watch([() => props.list, () => props.type], () => { | |
| stopAnimation(); | |
| initStatusList(); | |
| startAnimation(); | |
| }); | |
| watch([() => props.type, () => statusList.value, () => props.duration], () => { | |
| stopAnimation(); | |
| startAnimation(); | |
| }); | |
| watch([() => props.list, () => props.type, () => statusList.value, () => props.duration], () => { | |
| stopAnimation(); | |
| initStatusList(); | |
| startAnimation(); | |
| }); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## epic-vue #330 +/- ##
===========================================
Coverage ? 90.33%
===========================================
Files ? 141
Lines ? 8215
Branches ? 3372
===========================================
Hits ? 7421
Misses ? 770
Partials ? 24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.