Skip to content

feat: add Loading component for vue#330

Open
adaex wants to merge 2 commits into
epic-vuefrom
feat-vue-loading
Open

feat: add Loading component for vue#330
adaex wants to merge 2 commits into
epic-vuefrom
feat-vue-loading

Conversation

@adaex
Copy link
Copy Markdown
Collaborator

@adaex adaex commented Jun 5, 2025

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts and components.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 class as a prop name may conflict with the HTML class attribute and can be confusing. Consider renaming it to customClass or className for clarity.
    class?: string;

packages/arcodesign-vue/components/loading/README.md:19

  • The list prop dynamically defaults based on type but the README shows - as its default. Consider documenting the auto-generated default values for clarity.
| list     | 当类型为`dot`或`spin`时有效,定义内部各元素的透明度                               | number\[\]                           | -      |

Comment on lines +87 to +98
&.line {
width: 100%;

.loading-line-start,
.loading-line-end {
.use-var(stop-color, loading-color);
}

.loading-line-start {
stop-opacity: 0;
}
}
Copy link

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .line selector is never used because LoadingType does not include a line type. Consider removing this block to avoid dead code.

Suggested change
&.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.

Copilot uses AI. Check for mistakes.
const actualSvgKey = computed(() => props.svgKey || `${Date.now()}-${Math.random()}`);

// 获取样式与浏览器前缀
function getStyleWithVendor(style: Record<string, any>) {
Copy link

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getStyleWithVendor function currently just returns the input style. Either implement vendor-prefix logic here or remove this stub to simplify the code.

Copilot uses AI. Check for mistakes.
Comment on lines +124 to +133
watch([() => props.list, () => props.type], () => {
stopAnimation();
initStatusList();
startAnimation();
});

watch([() => props.type, () => statusList.value, () => props.duration], () => {
stopAnimation();
startAnimation();
});
Copy link

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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();
});

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (epic-vue@1dc4dfa). Learn more about missing BASE report.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@adaex adaex added the Vue label Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants