Skip to content

Commit

Permalink
Merge pull request #97 from jujijigo/main
Browse files Browse the repository at this point in the history
from color-picker model bind
  • Loading branch information
zds-s authored Jan 18, 2024
2 parents 0e6b7e0 + 610df13 commit 82780f9
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/components/ma-colorPicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,29 @@
</a-input-group>
</template>
<script setup>
import { ref, watch, reactive } from 'vue'
import { reactive, computed } from 'vue'
import { ColorPicker } from 'vue-color-kit'
import 'vue-color-kit/dist/vue-color-kit.css'
import { generate, getRgbStr } from '@arco-design/color'
import useClipboard from 'vue-clipboard3'
import { Message } from '@arco-design/web-vue'
const val = ref()
const props = defineProps({
modelValue: String,
placeholder: { type: String, default: '请选择颜色' },
})
const emit = defineEmits(['update:modelValue'])
const val = computed({
get() {
return props.modelValue
},
set(newVal) {
emit('update:modelValue', newVal)
}
}
)
const selectColor = (color) => {
val.value = color.hex
}
Expand All @@ -53,10 +63,4 @@ const defaultColorList = reactive([
'#86909c', '#6d4c41',
])
const emit = defineEmits(['update:modelValue'])
watch(
() => val.value,
vl => emit('update:modelValue', vl)
)
</script>

0 comments on commit 82780f9

Please sign in to comment.