Skip to content

Commit 90d0c1f

Browse files
committed
fix: some fixes
1 parent cf7c8bd commit 90d0c1f

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

src/components/chips/MdChipSet.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default {
2525
slotItems.map((item, index) => {
2626
return h(MdFilterChip, {
2727
...item.props,
28-
selected: index === props.modelValue,
28+
selected: index === props.modelValue || item.props.selected,
2929
onClick: () => selectChip(index),
3030
});
3131
})

src/components/chips/MdFilterChip.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<MdIcon v-if="selected">check</MdIcon>
88
<MdIcon v-else>{{ leadingIcon }}</MdIcon>
99
</div>
10-
<div v-else class="md-filter-chip__leading-icon">
10+
<div v-else-if="hasLeadingIconSlot" class="md-filter-chip__leading-icon">
1111
<slot name="leading-icon" />
1212
</div>
1313
<div class="md-filter-chip__text">{{ label }}</div>
@@ -18,10 +18,13 @@
1818
</template>
1919

2020
<script setup>
21+
import { computed, useSlots } from 'vue';
2122
import MdIcon from '../icon/MdIcon.vue';
2223
import MdRipple from '../ripple/MdRipple.vue';
2324
24-
defineProps({
25+
const slots = useSlots();
26+
27+
const props = defineProps({
2528
label: {
2629
type: String,
2730
},
@@ -41,6 +44,14 @@ defineProps({
4144
type: Boolean,
4245
},
4346
});
47+
48+
const hasSlot = (name) => {
49+
return !!slots[name];
50+
};
51+
52+
const hasLeadingIconSlot = computed(() => {
53+
return hasSlot('leading-icon');
54+
});
4455
</script>
4556

4657
<style lang="scss">

src/components/snackbar/MdSnackbar.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ $theme: tokens.md-comp-snackbar-values();
7373
transform: translateX(-50%);
7474
display: flex;
7575
align-items: center;
76+
box-sizing: content-box;
77+
line-height: map.get($theme, supporting-text-line-height);
7678
7779
background-color: map.get($theme, container-color);
7880
border-radius: map.get($theme, container-shape);
@@ -172,6 +174,7 @@ $theme: tokens.md-comp-snackbar-values();
172174
&--longer-action {
173175
flex-wrap: wrap;
174176
padding: 12px 0 6px 0;
177+
height: auto;
175178
176179
.md-snackbar__supporting-text {
177180
width: 100%;

src/components/switch/MdSwitch.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const props = defineProps({
2727
type: String,
2828
},
2929
modelValue: {
30-
type: String,
30+
type: Boolean,
3131
},
3232
checked: {
3333
type: Boolean,
@@ -42,6 +42,14 @@ watch(
4242
{ immediate: true },
4343
);
4444
45+
watch(
46+
() => props.modelValue,
47+
(newValue) => {
48+
_checked.value = newValue;
49+
},
50+
{ immediate: true },
51+
);
52+
4553
const toggle = () => {
4654
if (!props.disabled) {
4755
_checked.value = !_checked.value;

0 commit comments

Comments
 (0)