Update select button
parent
e37b4ec1bf
commit
820c9267be
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 80 KiB |
|
@ -118,7 +118,7 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
img.flag {
|
img.flag {
|
||||||
width: 28px;
|
width: 18px;
|
||||||
margin-right: .5rem;
|
margin-right: .5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,24 +9,18 @@
|
||||||
|
|
||||||
<div class="content-section implementation">
|
<div class="content-section implementation">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h5>Single</h5>
|
<h5>Single Selection</h5>
|
||||||
<SelectButton v-model="selectedCity" :options="cities" optionLabel="name" />
|
<SelectButton v-model="value1" :options="options" />
|
||||||
<p>Selected City: <span style="font-weight: bold">{{selectedCity}}</span></p>
|
|
||||||
|
|
||||||
<h5>Multiple</h5>
|
<h5>Multiple Selection</h5>
|
||||||
<SelectButton v-model="selectedCars" :options="cars" optionLabel="brand" :multiple="true" />
|
<SelectButton v-model="value2" :options="paymentOptions" optionLabel="name" multiple />
|
||||||
<p>Selected Cars: <span style="font-weight: bold">{{selectedCars}}</span></p>
|
|
||||||
|
|
||||||
<h5>Custom Content</h5>
|
<h5>Custom Content</h5>
|
||||||
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
<SelectButton v-model="value3" :options="justifyOptions">
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div class="car-option">
|
<i :class="slotProps.option.icon"></i>
|
||||||
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" />
|
|
||||||
<div>{{slotProps.option.brand}}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</SelectButton>
|
</SelectButton>
|
||||||
<p>Selected Car: <span style="font-weight: bold">{{selectedCar}}</span></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -40,39 +34,24 @@ import SelectButtonDoc from './SelectButtonDoc';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedCity: null,
|
value1: 'Off',
|
||||||
selectedCar: null,
|
value2: null,
|
||||||
selectedCars: null,
|
value3: null,
|
||||||
cities: [
|
options: ['Off', 'On'],
|
||||||
{name: 'London', code: 'LND'},
|
paymentOptions: [
|
||||||
{name: 'Paris', code: 'PRS'},
|
{name: 'Option 1', value: 1},
|
||||||
{name: 'Rome', code: 'RM'}
|
{name: 'Option 2', value: 2},
|
||||||
|
{name: 'Option 3', value: 3}
|
||||||
],
|
],
|
||||||
cars: [
|
justifyOptions: [
|
||||||
{brand: 'Audi', key: 'A'},
|
{icon: 'pi pi-align-left', value: 'left'},
|
||||||
{brand: 'BMW', key: 'B'},
|
{icon: 'pi pi-align-right', value: 'Right'},
|
||||||
{brand: 'Mercedes', key: 'M'}
|
{icon: 'pi pi-align-center', value: 'Center'},
|
||||||
]
|
{icon: 'pi pi-align-justify', value: 'Justify'}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
this.selectedCar = this.cars[1];
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
'SelectButtonDoc': SelectButtonDoc
|
'SelectButtonDoc': SelectButtonDoc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
/deep/ .car-option {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
img {
|
|
||||||
width: 24px;
|
|
||||||
margin-right: .5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -160,24 +160,18 @@ export default {
|
||||||
</a>
|
</a>
|
||||||
<CodeHighlight>
|
<CodeHighlight>
|
||||||
<template v-pre>
|
<template v-pre>
|
||||||
<h3>Single</h3>
|
<h5>Single Selection</h5>
|
||||||
<SelectButton v-model="selectedCity" :options="cities" optionLabel="name" />
|
<SelectButton v-model="value1" :options="options" />
|
||||||
<p>Selected City: <span style="font-weight: bold">{{selectedCity}}</span></p>
|
|
||||||
|
|
||||||
<h3>Multiple</h3>
|
<h5>Multiple Selection</h5>
|
||||||
<SelectButton v-model="selectedCars" :options="cars" optionLabel="brand" :multiple="true" />
|
<SelectButton v-model="value2" :options="paymentOptions" optionLabel="name" multiple />
|
||||||
<p>Selected Cars: <span style="font-weight: bold">{{selectedCars}}</span></p>
|
|
||||||
|
|
||||||
<h3>Custom Content</h3>
|
<h5>Custom Content</h5>
|
||||||
<SelectButton v-model="selectedCar" :options="cars" optionLabel="brand">
|
<SelectButton v-model="value3" :options="justifyOptions">
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div class="car-option">
|
<i :class="slotProps.option.icon"></i>
|
||||||
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" />
|
|
||||||
<div>{{slotProps.option.brand}}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</SelectButton>
|
</SelectButton>
|
||||||
<p>Selected Car: <span style="font-weight: bold">{{selectedCar}}</span></p>
|
|
||||||
</template>
|
</template>
|
||||||
</CodeHighlight>
|
</CodeHighlight>
|
||||||
|
|
||||||
|
@ -185,36 +179,21 @@ export default {
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedCity: null,
|
value1: 'Off',
|
||||||
selectedCar: null,
|
value2: null,
|
||||||
selectedCars: null,
|
value3: null,
|
||||||
cities: [
|
options: ['Off', 'On'],
|
||||||
{name: 'London', code: 'LND'},
|
paymentOptions: [
|
||||||
{name: 'Paris', code: 'PRS'},
|
{name: 'Option 1', value: 1},
|
||||||
{name: 'Rome', code: 'RM'}
|
{name: 'Option 2', value: 2},
|
||||||
|
{name: 'Option 3', value: 3}
|
||||||
],
|
],
|
||||||
cars: [
|
justifyOptions: [
|
||||||
{brand: 'Audi', key: 'A'},
|
{icon: 'pi pi-align-left', value: 'left'},
|
||||||
{brand: 'BMW', key: 'B'},
|
{icon: 'pi pi-align-right', value: 'Right'},
|
||||||
{brand: 'Mercedes', key: 'M'}
|
{icon: 'pi pi-align-center', value: 'Center'},
|
||||||
]
|
{icon: 'pi pi-align-justify', value: 'Justify'}]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
created() {
|
|
||||||
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: .5rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</CodeHighlight>
|
</CodeHighlight>
|
||||||
|
|
Loading…
Reference in New Issue