SelectButton demo update
parent
7016969524
commit
ebf550f535
|
@ -19,9 +19,9 @@
|
||||||
<h3>Custom Content</h3>
|
<h3>Custom Content</h3>
|
||||||
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div style="text-align: center; padding: 1em; width: 125px">
|
<div class="car-option">
|
||||||
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" style="width:48px" />
|
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" />
|
||||||
<div style="margin-top: 1em">{{slotProps.option.brand}}</div>
|
<div>{{slotProps.option.brand}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</SelectButton>
|
</SelectButton>
|
||||||
|
@ -61,3 +61,16 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/deep/ .car-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 24px;
|
||||||
|
margin-right: .5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -40,9 +40,9 @@ export default {
|
||||||
<template v-pre>
|
<template v-pre>
|
||||||
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div style="text-align: center; padding: 1em; width: 125px">
|
<div class="car-option">
|
||||||
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" style="width:48px" />
|
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" />
|
||||||
<div style="margin-top: 1em">{{slotProps.option.brand}}</div>
|
<div>{{slotProps.option.brand}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</SelectButton>
|
</SelectButton>
|
||||||
|
@ -171,9 +171,9 @@ export default {
|
||||||
<h3>Custom Content</h3>
|
<h3>Custom Content</h3>
|
||||||
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div style="text-align: center; padding: 1em; width: 125px">
|
<div class="car-option">
|
||||||
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" style="width:48px" />
|
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" />
|
||||||
<div style="margin-top: 1em">{{slotProps.option.brand}}</div>
|
<div>{{slotProps.option.brand}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</SelectButton>
|
</SelectButton>
|
||||||
|
@ -204,6 +204,19 @@ export default {
|
||||||
this.selectedCar = this.cars[1];
|
this.selectedCar = this.cars[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
</CodeHighlight>
|
||||||
|
|
||||||
|
<CodeHighlight lang="css">
|
||||||
|
/deep/ .car-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 24px;
|
||||||
|
margin-right: .5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
</CodeHighlight>
|
</CodeHighlight>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabView>
|
</TabView>
|
||||||
|
|
Loading…
Reference in New Issue