Update checkbox and radio demos

pull/358/head
cagataycivici 2020-06-30 17:07:01 +03:00
parent 2b2b98633b
commit ffbc27b7f3
4 changed files with 44 additions and 44 deletions

View File

@ -36,11 +36,11 @@
<p>Selected Cities : <span style="font-weight: bold">{{cities}}</span></p> <p>Selected Cities : <span style="font-weight: bold">{{cities}}</span></p>
<h5>Dynamic Values, Preselection, Value Binding and Disabled Option</h5> <h5>Dynamic Values, Preselection, Value Binding and Disabled Option</h5>
<div v-for="theme of themes" :key="theme.key" class="p-field-checkbox"> <div v-for="category of categories" :key="category.key" class="p-field-checkbox">
<Checkbox :id="theme.key" name="theme" :value="theme" v-model="selectedThemes" :disabled="theme.key === 'U'"/> <Checkbox :id="category.key" name="category" :value="category" v-model="selectedCategories" :disabled="category.key === 'R'"/>
<label :for="theme.key">{{theme.name}}</label> <label :for="category.key">{{category.name}}</label>
</div> </div>
<p>Selected Themes: <span style="font-weight: bold">{{this.selectedThemes}}</span></p> <p>Selected Categories: <span style="font-weight: bold">{{this.selectedCategories}}</span></p>
</div> </div>
</div> </div>
@ -56,12 +56,12 @@ export default {
return { return {
checked: false, checked: false,
cities: [], cities: [],
themes: [{name: 'Apollo', key: 'A'}, {name: 'Babylon', key: 'B'}, {name: 'Serenity', key: 'S'}, {name: 'Ultima', key: 'U'}], categories: [{name: 'Accounting', key: 'A'}, {name: 'Marketing', key: 'M'}, {name: 'Production', key: 'P'}, {name: 'Research', key: 'R'}],
selectedThemes: [] selectedCategories: []
} }
}, },
created() { created() {
this.selectedThemes = this.themes.slice(1,3); this.selectedCategories = this.categories.slice(1,3);
}, },
components: { components: {
'CheckboxDoc': CheckboxDoc 'CheckboxDoc': CheckboxDoc

View File

@ -171,27 +171,27 @@ export default {
&lt;p&gt;Selected Cities : &lt;span style="font-weight: bold"&gt;{{cities}}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Selected Cities : &lt;span style="font-weight: bold"&gt;{{cities}}&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Dynamic Values, Preselection, Value Binding and Disabled Option&lt;/h3&gt; &lt;h3&gt;Dynamic Values, Preselection, Value Binding and Disabled Option&lt;/h3&gt;
&lt;div v-for="theme of themes" :key="theme.key" class="p-field-checkbox"&gt; &lt;div v-for="category of categories" :key="category.key" class="p-field-checkbox"&gt;
&lt;Checkbox :id="theme.key" name="theme" :value="theme" v-model="selectedThemes" :disabled="theme.key === 'U'"/&gt; &lt;Checkbox :id="category.key" name="category" :value="category" v-model="selectedCategories" :disabled="category.key === 'R'"/&gt;
&lt;label :for="theme.key"&gt;{{theme.name}}&lt;/label&gt; &lt;label :for="category.key"&gt;{{category.name}}&lt;/label&gt;
&lt;/div&gt; &lt;/div&gt;
&lt;p&gt;Selected Themes: &lt;span style="font-weight: bold"&gt;{{this.selectedThemes}}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Selected Categories: &lt;span style="font-weight: bold"&gt;{{this.selectedCategories}}&lt;/span&gt;&lt;/p&gt;
</template> </template>
</CodeHighlight> </CodeHighlight>
<CodeHighlight lang="javascript"> <CodeHighlight lang="javascript">
export default { export default {
data() { data() {
return { return {
checked: false, checked: false,
cities: [], cities: [],
themes: [{name: 'Apollo', key: 'A'}, {name: 'Babylon', key: 'B'}, {name: 'Serenity', key: 'S'}, {name: 'Ultima', key: 'U'}], categories: [{name: 'Accounting', key: 'A'}, {name: 'Marketing', key: 'M'}, {name: 'Production', key: 'P'}, {name: 'Research', key: 'R'}],
selectedThemes: [] selectedCategories: []
} }
}, },
created() { created() {
this.selectedThemes = this.themes.slice(1,3); this.selectedCategories = this.categories.slice(1,3);
} }
} }
</CodeHighlight> </CodeHighlight>
</TabPanel> </TabPanel>

View File

@ -30,11 +30,11 @@
<p>Selected City: <span style="font-weight: bold">{{this.city}}</span></p> <p>Selected City: <span style="font-weight: bold">{{this.city}}</span></p>
<h5>Dynamic Values, Preselection, Value Binding and Disabled Option</h5> <h5>Dynamic Values, Preselection, Value Binding and Disabled Option</h5>
<div v-for="theme of themes" :key="theme.key" class="p-field-radiobutton"> <div v-for="category of categories" :key="category.key" class="p-field-radiobutton">
<RadioButton :id="theme.key" name="theme" :value="theme" v-model="selectedTheme" :disabled="theme.key === 'U'" /> <RadioButton :id="category.key" name="category" :value="category" v-model="selectedCategory" :disabled="category.key === 'R'" />
<label :for="theme.key">{{theme.name}}</label> <label :for="category.key">{{category.name}}</label>
</div> </div>
<p>Selected Theme: <span style="font-weight: bold">{{this.selectedTheme}}</span></p> <p>Selected Category: <span style="font-weight: bold">{{this.selectedCategory}}</span></p>
</div> </div>
</div> </div>
@ -49,12 +49,12 @@ export default {
data() { data() {
return { return {
city: null, city: null,
themes: [{name: 'Apollo', key: 'A'}, {name: 'Babylon', key: 'B'}, {name: 'Serenity', key: 'S'}, {name: 'Ultima', key: 'U'}], categories: [{name: 'Accounting', key: 'A'}, {name: 'Marketing', key: 'M'}, {name: 'Production', key: 'P'}, {name: 'Research', key: 'R'}],
selectedTheme: null selectedCategory: null
} }
}, },
created() { created() {
this.selectedTheme = this.themes[1]; this.selectedCategory = this.categories[1];
}, },
components: { components: {
'RadioButtonDoc': RadioButtonDoc 'RadioButtonDoc': RadioButtonDoc

View File

@ -156,27 +156,27 @@ export default {
&lt;/div&gt; &lt;/div&gt;
&lt;p&gt;Selected City: &lt;span style="font-weight: bold"&gt;{{this.city}}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Selected City: &lt;span style="font-weight: bold"&gt;{{this.city}}&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Dynamic Values, Preselection, Value Binding and Disabled Option&lt;/h3&gt; &lt;h5&gt;Dynamic Values, Preselection, Value Binding and Disabled Option&lt;/h5&gt;
&lt;div v-for="theme of themes" :key="theme.key" class="p-field-radiobutton"&gt; &lt;div v-for="category of categories" :key="category.key" class="p-field-radiobutton"&gt;
&lt;RadioButton :id="theme.key" name="theme" :value="theme" v-model="selectedTheme" :disabled="theme.key === 'U'" /&gt; &lt;RadioButton :id="category.key" name="category" :value="category" v-model="selectedCategory" :disabled="category.key === 'R'" /&gt;
&lt;label :for="theme.key"&gt;{{theme.name}}&lt;/label&gt; &lt;label :for="category.key"&gt;{{category.name}}&lt;/label&gt;
&lt;/div&gt; &lt;/div&gt;
&lt;p&gt;Selected Theme: &lt;span style="font-weight: bold"&gt;{{this.selectedTheme}}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Selected Category: &lt;span style="font-weight: bold"&gt;{{this.selectedCategory}}&lt;/span&gt;&lt;/p&gt;
</template> </template>
</CodeHighlight> </CodeHighlight>
<CodeHighlight lang="javascript"> <CodeHighlight lang="javascript">
export default { export default {
data() { data() {
return { return {
city: null, city: null,
themes: [{name: 'Apollo', key: 'A'}, {name: 'Babylon', key: 'B'}, {name: 'Serenity', key: 'S'}, {name: 'Ultima', key: 'U'}], categories: [{name: 'Accounting', key: 'A'}, {name: 'Marketing', key: 'M'}, {name: 'Production', key: 'P'}, {name: 'Research', key: 'R'}],
selectedTheme: null selectedCategory: null
} }
}, },
created() { created() {
this.selectedTheme = this.themes[1]; this.selectedCategory = this.categories[1];
} }
} }
</CodeHighlight> </CodeHighlight>
</TabPanel> </TabPanel>