Last active
March 5, 2021 16:30
-
-
Save Avi-E-Koenig/3617b552963c95fa3789806637f9583f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
name: 'color-picker', | |
template: /*html*/ ` | |
<div class="row" style="margin-bottom:0;"> | |
<div | |
class="input-field col s12" | |
@click="openColorPicker"> | |
<i class="material-icons prefix">color</i> | |
<input | |
type="text" | |
disabled | |
v-model="color" /> | |
<span class="highlight"></span> | |
<span class="bar"></span> | |
<label>{{title}}</label> | |
<input | |
ref="colorInput" | |
type="color" | |
style="visibility:hidden;" | |
v-model="color" | |
@input="$emit('colorSelected',color)" /> | |
</div> | |
</div> | |
`, | |
props: ['title', 'default'], | |
data() { | |
return { color: this.default || '#fff' }; | |
}, | |
methods: { | |
openColorPicker() { | |
this.$refs.colorInput.focus(); | |
this.$refs.colorInput.click(); | |
}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment