-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comp:card): add selection state and disabled state
- Loading branch information
Showing
13 changed files
with
291 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ exports[`Card > render work 1`] = ` | |
<p>Some Content</p> | ||
</div> | ||
<!----> | ||
<!----> | ||
</div>" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 7 | ||
title: | ||
zh: 禁用 | ||
en: Disabled State | ||
--- | ||
|
||
## zh | ||
|
||
如果 `disabled` 属性为 `true`,卡片为禁用状态。 | ||
|
||
## en | ||
|
||
If the `disabled` property is `true`, the card is disabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<IxRow> | ||
<IxCol xs="24" sm="8"> | ||
<IxCard :header="{ title: 'Card title', extra: 'setting' }" disabled> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
</IxCard> | ||
</IxCol> | ||
</IxRow> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
order: 8 | ||
title: | ||
zh: 配置可选 | ||
en: Selected State | ||
--- | ||
|
||
## zh | ||
|
||
通过 `seletable` 属性来配置卡片是否可以选中,其中,如果 `selected` 属性为 `true`,卡片被选中。 | ||
|
||
如果 `disabled` 属性为 `true`,卡片为禁用状态,不可变更选择状态。 | ||
|
||
## en | ||
|
||
Configure whether the card can be selected through the attribute `selectable`. | ||
|
||
If `selected` is `true`, it means the card is selected. | ||
|
||
If the `disabled` property is `true`, the card is disabled and the selection state cannot be changed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
<IxRow> | ||
<IxCol xs="24" sm="8"> | ||
<div>Selected: {{ selected1 }}</div> | ||
<IxCard | ||
v-model:selected="selected1" | ||
:header="{ title: 'Selectable', extra: 'setting' }" | ||
size="lg" | ||
selectable | ||
@selectedChange="logSelected" | ||
> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
</IxCard> | ||
</IxCol> | ||
<IxCol xs="24" sm="8"> | ||
<div>Selected: {{ selected2 }}</div> | ||
<IxCard | ||
v-model:selected="selected1" | ||
:header="{ title: 'Disabled and selected', extra: 'setting' }" | ||
selectable | ||
disabled | ||
> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
</IxCard> | ||
</IxCol> | ||
<IxCol xs="24" sm="8"> | ||
<div>Selected: {{ selected3 }}</div> | ||
<IxCard | ||
v-model:selected="selected1" | ||
:header="{ title: 'Disable and unselected', extra: 'setting' }" | ||
selectable | ||
disabled | ||
> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
<p>Card content</p> | ||
</IxCard> | ||
</IxCol> | ||
</IxRow> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
const selected1 = ref(true) | ||
const selected2 = ref(true) | ||
const selected3 = ref(false) | ||
const logSelected = selected => { | ||
console.log(`selected is ${selected}`) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.