-
Notifications
You must be signed in to change notification settings - Fork 331
feat(tag): [tag] add round prop to support circular border radius #3846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,6 +175,18 @@ export default { | |
| mode: ['pc', 'mobile-first'], | ||
| pcDemo: 'basic-usage', | ||
| mfDemo: '' | ||
| }, | ||
| { | ||
| name: 'round', | ||
| type: 'boolean', | ||
| defaultValue: 'false', | ||
| desc: { | ||
| 'zh-CN': '是否为圆角的模式', | ||
| 'en-US': 'Whether it is a circular mode' | ||
| }, | ||
| mode: ['pc'], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 新特性需要添加版本信息哈 |
||
| pcDemo: 'round', | ||
| mfDemo: '' | ||
| } | ||
| ], | ||
| events: [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||||||||||||||||
| <template> | ||||||||||||||||||||
| <div class="tag-round-demo"> | ||||||||||||||||||||
| <h4>Round 属性示例</h4> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <tiny-tag type="primary" round>圆角标签</tiny-tag> | ||||||||||||||||||||
| <tiny-tag type="success" round>成功标签</tiny-tag> | ||||||||||||||||||||
| <tiny-tag type="warning" round>警告标签</tiny-tag> | ||||||||||||||||||||
| <tiny-tag type="danger" round>危险标签</tiny-tag> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <tiny-tag type="info" round only-icon> | ||||||||||||||||||||
| <tiny-icon-heartempty /> | ||||||||||||||||||||
| </tiny-tag> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| </template> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <script setup> | ||||||||||||||||||||
| import { TinyTag } from '@opentiny/vue' | ||||||||||||||||||||
| import { IconHeartempty } from '@opentiny/vue-icon' | ||||||||||||||||||||
| const tinyIconHeartempty = IconHeartempty() | ||||||||||||||||||||
| </script> | ||||||||||||||||||||
|
Comment on lines
+16
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused variable or register the component properly. The variable Consider one of these solutions: Option 1: Remove the unused variable and import (if auto-registration works): <script setup>
import { TinyTag } from '@opentiny/vue'
-import { IconHeartempty } from '@opentiny/vue-icon'
-
-const tinyIconHeartempty = IconHeartempty()
</script>Option 2: Register and use the component explicitly: <script setup>
import { TinyTag } from '@opentiny/vue'
import { IconHeartempty } from '@opentiny/vue-icon'
-const tinyIconHeartempty = IconHeartempty()
+const TinyIconHeartempty = IconHeartempty()
</script>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| <style scoped> | ||||||||||||||||||||
| .tiny-tag { | ||||||||||||||||||||
| margin-right: 12px; | ||||||||||||||||||||
| margin-bottom: 12px; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| h4 { | ||||||||||||||||||||
| margin-bottom: 16px; | ||||||||||||||||||||
| color: #333; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| </style> | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,85 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { test, expect } from '@playwright/test' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('round 属性基础测试', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.on('pageerror', (exception) => expect(exception).not.toBeNull()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto('tag#round-usage') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 测试圆角标签是否存在 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const roundTag = page.locator('.tiny-tag').filter({ hasText: '圆角标签' }).first() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(roundTag).toHaveCount(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 验证圆角标签具有圆角样式 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(roundTag).toHaveCSS('border-radius', '9999px') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 测试成功标签的圆角 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const successTag = page.locator('.tiny-tag').filter({ hasText: '成功标签' }).first() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(successTag).toHaveCSS('border-radius', '9999px') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 测试警告标签的圆角 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const warningTag = page.locator('.tiny-tag').filter({ hasText: '警告标签' }).first() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(warningTag).toHaveCSS('border-radius', '9999px') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 测试危险标签的圆角 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const dangerTag = page.locator('.tiny-tag').filter({ hasText: '危险标签' }).first() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(dangerTag).toHaveCSS('border-radius', '9999px') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('round 属性特殊标签测试', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.on('pageerror', (exception) => expect(exception).not.toBeNull()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto('tag#round-usage') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 测试圆角图标标签 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const iconTag = page.locator('.tiny-tag--only-icon').first() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(iconTag).toHaveCSS('border-radius', '9999px') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 测试圆角配置式标签 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const valueTag = page.locator('.tiny-tag').filter({ hasText: '圆角配置标签' }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(valueTag).toHaveCount(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(valueTag).toHaveCSS('border-radius', '9999px') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('round 属性样式验证', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.on('pageerror', (exception) => expect(exception).not.toBeNull()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto('tag#round-usage') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 验证所有具有round属性的标签都具有正确的圆角样式 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const roundTags = page.locator('.tiny-tag') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const count = await roundTags.count() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (let i = 0; i < count; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const tag = roundTags.nth(i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(tag).toHaveCSS('border-radius', '9999px') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 验证标签数量是否正确 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(count).toBe(6) // 4个基础标签 + 1个图标标签 + 1个配置标签 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('round 属性样式验证', async ({ page }) => { | |
| page.on('pageerror', (exception) => expect(exception).not.toBeNull()) | |
| await page.goto('tag#round-usage') | |
| // 验证所有具有round属性的标签都具有正确的圆角样式 | |
| const roundTags = page.locator('.tiny-tag') | |
| const count = await roundTags.count() | |
| for (let i = 0; i < count; i++) { | |
| const tag = roundTags.nth(i) | |
| await expect(tag).toHaveCSS('border-radius', '9999px') | |
| } | |
| // 验证标签数量是否正确 | |
| expect(count).toBe(6) // 4个基础标签 + 1个图标标签 + 1个配置标签 | |
| }) | |
| test('round 属性样式验证', async ({ page }) => { | |
| page.on('pageerror', (exception) => expect(exception).not.toBeNull()) | |
| await page.goto('tag#round-usage') | |
| // 验证所有具有round属性的标签都具有正确的圆角样式 | |
| const roundTags = page.locator('.tiny-tag') | |
| const count = await roundTags.count() | |
| for (let i = 0; i < count; i++) { | |
| const tag = roundTags.nth(i) | |
| await expect(tag).toHaveCSS('border-radius', '9999px') | |
| } | |
| // 验证标签数量是否正确 | |
| expect(count).toBe(5) // 4个基础标签 + 1个图标标签 | |
| }) |
🤖 Prompt for AI Agents
In examples/sites/demos/pc/app/tag/round.spec.ts around lines 41 to 56, the test
asserts expect(count).toBe(6) but the demos only render 5 tags; update the test
to match the source of truth by changing the expectation to
expect(count).toBe(5) (or alternatively add the missing config tag to the round
demo files if the intention is to keep 6), and run the spec to verify it passes.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <template> | ||
| <div class="tag-round-demo"> | ||
| <h4>Round 属性示例</h4> | ||
|
|
||
| <tiny-tag type="primary" :round="true">圆角标签</tiny-tag> | ||
| <tiny-tag type="success" :round="true">成功标签</tiny-tag> | ||
| <tiny-tag type="warning" :round="true">警告标签</tiny-tag> | ||
| <tiny-tag type="danger" :round="true">危险标签</tiny-tag> | ||
|
|
||
| <tiny-tag type="info" :round="true" :only-icon="true"> | ||
| <template #default> | ||
| <icon-heartempty /> | ||
| </template> | ||
| </tiny-tag> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { Tag, Icon } from '@opentiny/vue' | ||
|
|
||
| export default { | ||
| components: { | ||
| TinyTag: Tag, | ||
| IconHeartempty: Icon.IconHeartempty | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| .tiny-tag { | ||
| margin-right: 12px; | ||
| margin-bottom: 12px; | ||
| } | ||
|
|
||
| h4 { | ||
| margin-bottom: 16px; | ||
| color: #333; | ||
| } | ||
| </style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify the English description.
The English description "Whether it is a circular mode" is ambiguous. "Circular" suggests a circle shape, but
roundhere refers to rounded corners (border-radius). The Chinese "圆角" correctly translates to "rounded corners."Apply this diff to improve clarity:
desc: { 'zh-CN': '是否为圆角的模式', - 'en-US': 'Whether it is a circular mode' + 'en-US': 'Whether to enable rounded corners' },📝 Committable suggestion
🤖 Prompt for AI Agents