-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(checkbox): [checkbox] Adapting to the SMB theme (#2130)
- Loading branch information
1 parent
a2fbaf6
commit d55c7fe
Showing
10 changed files
with
143 additions
and
86 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
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
53 changes: 48 additions & 5 deletions
53
examples/sites/demos/pc/app/checkbox/vertical-checkbox-composition-api.vue
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 |
---|---|---|
@@ -1,13 +1,56 @@ | ||
<template> | ||
<tiny-checkbox-group v-model="checkboxGroup" vertical> | ||
<tiny-checkbox-button v-for="city in cities" :label="city" :key="city">{{ city }}</tiny-checkbox-button> | ||
</tiny-checkbox-group> | ||
<div class="demo-checkbox-vertical"> | ||
<div> | ||
<tiny-checkbox-group v-model="checkboxGroup" vertical> | ||
<tiny-checkbox-button v-for="city in cities" :label="city" :key="city">{{ city }}</tiny-checkbox-button> | ||
</tiny-checkbox-group> | ||
</div> | ||
<div> | ||
<tiny-checkbox :indeterminate="isIndeterminate" v-model="checkAll"> 全选 </tiny-checkbox> | ||
<br /><br /> | ||
<tiny-checkbox-group v-model="checkboxGroup" vertical> | ||
<tiny-checkbox v-for="(city, index) in cities" :label="city" :key="index"> | ||
{{ city }} | ||
</tiny-checkbox> | ||
</tiny-checkbox-group> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref } from 'vue' | ||
import { CheckboxGroup as TinyCheckboxGroup, CheckboxButton as TinyCheckboxButton } from '@opentiny/vue' | ||
import { ref, computed } from 'vue' | ||
import { | ||
CheckboxGroup as TinyCheckboxGroup, | ||
CheckboxButton as TinyCheckboxButton, | ||
Checkbox as TinyCheckbox | ||
} from '@opentiny/vue' | ||
const checkboxGroup = ref(['上海']) | ||
const cities = ref(['上海', '北京', '广州', '深圳']) | ||
const isIndeterminate = computed({ | ||
get() { | ||
return checkboxGroup.value.length > 0 && checkboxGroup.value.length !== cities.value.length | ||
} | ||
}) | ||
const checkAll = computed({ | ||
get() { | ||
return checkboxGroup.value.length === cities.value.length | ||
}, | ||
set(val) { | ||
if (val) { | ||
checkboxGroup.value = [...cities.value] | ||
} else { | ||
checkboxGroup.value = [] | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.demo-checkbox-vertical { | ||
display: flex; | ||
align-items: center; | ||
width: 300px; | ||
justify-content: space-between; | ||
} | ||
</style> |
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
52 changes: 47 additions & 5 deletions
52
examples/sites/demos/pc/app/checkbox/vertical-checkbox.vue
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 |
---|---|---|
@@ -1,22 +1,64 @@ | ||
<template> | ||
<tiny-checkbox-group v-model="checkboxGroup" vertical> | ||
<tiny-checkbox-button v-for="city in cities" :label="city" :key="city">{{ city }}</tiny-checkbox-button> | ||
</tiny-checkbox-group> | ||
<div class="demo-checkbox-vertical"> | ||
<div> | ||
<tiny-checkbox-group v-model="checkboxGroup" vertical> | ||
<tiny-checkbox-button v-for="city in cities" :label="city" :key="city">{{ city }}</tiny-checkbox-button> | ||
</tiny-checkbox-group> | ||
</div> | ||
<div> | ||
<tiny-checkbox :indeterminate="isIndeterminate" v-model="checkAll"> 全选 </tiny-checkbox> | ||
<br /><br /> | ||
<tiny-checkbox-group v-model="checkboxGroup" vertical> | ||
<tiny-checkbox v-for="(city, index) in cities" :label="city" :key="index"> | ||
{{ city }} | ||
</tiny-checkbox> | ||
</tiny-checkbox-group> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { CheckboxGroup, CheckboxButton } from '@opentiny/vue' | ||
import { Checkbox, CheckboxGroup, CheckboxButton } from '@opentiny/vue' | ||
export default { | ||
components: { | ||
TinyCheckboxGroup: CheckboxGroup, | ||
TinyCheckboxButton: CheckboxButton | ||
TinyCheckboxButton: CheckboxButton, | ||
TinyCheckbox: Checkbox | ||
}, | ||
data() { | ||
return { | ||
checkboxGroup: ['上海'], | ||
cities: ['上海', '北京', '广州', '深圳'] | ||
} | ||
}, | ||
computed: { | ||
isIndeterminate: { | ||
get() { | ||
return this.checkboxGroup.length > 0 && this.checkboxGroup.length !== this.cities.length | ||
} | ||
}, | ||
checkAll: { | ||
get() { | ||
return this.checkboxGroup.length === this.cities.length | ||
}, | ||
set(val) { | ||
if (val) { | ||
this.checkboxGroup = [...this.cities] | ||
} else { | ||
this.checkboxGroup = [] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.demo-checkbox-vertical { | ||
display: flex; | ||
align-items: center; | ||
width: 300px; | ||
justify-content: space-between; | ||
} | ||
</style> |
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