File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff 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 })
Original file line number Diff line number Diff line change 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 >
1818</template >
1919
2020<script setup>
21+ import { computed , useSlots } from ' vue' ;
2122import MdIcon from ' ../icon/MdIcon.vue' ;
2223import 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">
Original file line number Diff line number Diff 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% ;
Original file line number Diff line number Diff 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+
4553const toggle = () => {
4654 if (! props .disabled ) {
4755 _checked .value = ! _checked .value ;
You can’t perform that action at this time.
0 commit comments