primevue-mirror/pages/radiobutton/index.vue

67 lines
2.4 KiB
Vue
Raw Normal View History

2022-09-09 20:41:18 +00:00
<template>
<div>
<div class="content-section introduction">
<div class="feature-intro">
<h1>RadioButton</h1>
<p>RadioButton is an extension to standard radio button element with theming.</p>
</div>
<AppDemoActions />
</div>
<div class="content-section implementation">
<div class="card">
<h5>Basic</h5>
<div class="field-radiobutton">
2022-12-08 12:26:57 +00:00
<RadioButton v-model="city" inputId="city1" name="city" value="Chicago" />
2022-09-09 20:41:18 +00:00
<label for="city1">Chicago</label>
</div>
<div class="field-radiobutton">
2022-12-08 12:26:57 +00:00
<RadioButton v-model="city" inputId="city2" name="city" value="Los Angeles" />
2022-09-09 20:41:18 +00:00
<label for="city2">Los Angeles</label>
</div>
<div class="field-radiobutton">
2022-12-08 12:26:57 +00:00
<RadioButton v-model="city" inputId="city3" name="city" value="New York" />
2022-09-09 20:41:18 +00:00
<label for="city3">New York</label>
</div>
<div class="field-radiobutton">
2022-12-08 12:26:57 +00:00
<RadioButton v-model="city" inputId="city4" name="city" value="San Francisco" />
2022-09-09 20:41:18 +00:00
<label for="city4">San Francisco</label>
</div>
<h5>Dynamic Values, Preselection, Value Binding and Disabled Option</h5>
<div v-for="category of categories" :key="category.key" class="field-radiobutton">
2022-12-08 12:26:57 +00:00
<RadioButton v-model="selectedCategory" :inputId="category.key" name="category" :value="category.name" :disabled="category.key === 'R'" />
2022-09-09 20:41:18 +00:00
<label :for="category.key">{{ category.name }}</label>
</div>
</div>
</div>
<RadioButtonDoc />
</div>
</template>
<script>
import RadioButtonDoc from './RadioButtonDoc';
export default {
data() {
return {
city: null,
categories: [
{ name: 'Accounting', key: 'A' },
{ name: 'Marketing', key: 'M' },
{ name: 'Production', key: 'P' },
{ name: 'Research', key: 'R' }
],
selectedCategory: null
};
},
created() {
this.selectedCategory = this.categories[1].name;
},
components: {
RadioButtonDoc: RadioButtonDoc
}
};
</script>