Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

update upstream #1

Merged
merged 4 commits into from
Dec 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions components/fields/components/color.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<field :class="classNames" v-bind="{id, inline, problems, label, validate, title, tooltip, editable, visible}">
<div slot="component">
<div v-show="editable" class="color-wrapper grid" :class="{'has-error': problems.length}">
<div class="color" :style="{'background': model.hex}"></div>
<div class="color" :style="{'background': hex}"></div>
<q-btn color="primary" class="color-button">
<q-icon name="search"></q-icon>
<q-popover ref="popover">
<sketch :value="model" @input="updateValue"></sketch>
<sketch :value="hex" @input="updateValue"></sketch>
</q-popover>
</q-btn>
</div>
Expand All @@ -29,20 +29,28 @@
},
name: 'field-color',
data: () => ({
model: {
hex: '#ffffff'
}
hex: ''
}),
props: {
color: {
type: String,
default: '#FFFFFF'
}
},
methods: {
updateValue (color) {
this.model.hex = color.hex
this.$emit('input', color.hex)
this.hex = color
this.$emit('input', color)
}
},
watch: {
value (color) {
this.model.hex = color
this.hex = color
}
},
created () {
this.hex = this.color
this.updateValue(this.color)
}
}
</script>
Expand Down