Vue events

This commit is contained in:
Samuel Elliott 2019-03-14 14:14:16 +00:00
parent 4925c969dd
commit 4f2d4fcd8a
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
6 changed files with 12 additions and 12 deletions

View File

@ -12,7 +12,7 @@
<div class="bd-settingSwitch">
<div class="bd-title">
<h3>{{item.text}}</h3>
<div class="bd-switchWrapper" @click="() => toggle(item)">
<div class="bd-switchWrapper" @click="$emit('toggle', item)">
<input type="checkbox" class="bd-switchCheckbox" />
<div class="bd-switch" :class="{'bd-checked': item.status.update}" />
</div>
@ -23,6 +23,6 @@
<script>
export default {
props: ['item', 'toggle']
props: ['item']
}
</script>

View File

@ -19,7 +19,7 @@
<div class="bd-formDivider"></div>
<div v-for="update in bdUpdates">
<UpdaterStatus :item="update" v-if="update.status.updating" />
<UpdaterToggle :item="update" :toggle="() => updater.toggleUpdate(update)" v-else />
<UpdaterToggle :item="update" @toggle="updater.toggleUpdate(update)" v-else />
<div class="bd-formDivider"></div>
</div>
</div>

View File

@ -22,6 +22,6 @@
<script>
export default {
props: ['item', 'onClick', 'checked']
props: ['item', 'checked']
}
</script>

View File

@ -9,13 +9,13 @@
*/
<template>
<div class="bd-button" :class="classes" @click="onClick">
<div class="bd-button" @click="$emit('click')">
{{text}}
</div>
</template>
<script>
export default {
props: ['classes', 'text', 'onClick']
props: ['text']
}
</script>

View File

@ -9,15 +9,15 @@
*/
<template>
<div class="bd-buttonGroup" :class="classes">
<Button v-for="(button, index) in buttons" :text="button.text" :classes="button.classes" :onClick="button.onClick" :key="index"/>
<div class="bd-buttonGroup">
<Button v-for="(button, index) in buttons" :text="button.text" :classes="button.class" @click="button.onClick" :key="index"/>
</div>
</template>
<script>
import Button from './Button.vue';
export default {
props: ['buttons', 'classes'],
props: ['buttons'],
components: { Button }
}
</script>

View File

@ -101,15 +101,15 @@ module.exports = (Plugin, Api, Vendor) => {
if (!returnValue.props.children instanceof Array) returnValue.props.children = [returnValue.props.children];
// Add a generic Button component provided by BD
returnValue.props.children.push(Api.Components.ButtonGroup({
classes: [ 'exampleBtnGroup' ], // Additional classes for button group
class: [ 'exampleBtnGroup' ], // Additional classes for button group
buttons: [
{
classes: ['exampleBtn'], // Additional classes for button
class: ['exampleBtn'], // Additional classes for button
text: 'Hello World!', // Text for button
onClick: e => Logger.log('Hello World!') // Button click handler
},
{
classes: ['exampleBtn'],
class: ['exampleBtn'],
text: 'Button',
onClick: e => Logger.log('Button!')
}