vue3-ts-picker
v2.2.5
Published
Vue3+ts的颜色选择器
Downloads
499
Maintainers
Readme
vue3-ts-picker
描述 这是一款基于 vue3+ts 的轻量级颜色取色器插件
npm
npm install --save vue3-ts-picker
yarn
$ yarn add save vue3-ts-picker
code
main.js:
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import {ColorPicker} from "vue3-ts-picker"
import "vue3-ts-picker/dist/vue3-ts-picker.css"
const app = createApp(App)
app.component('ColorPicker', ColorPicker)
app.mount('#app')
template:
<template>
<div id="nav">
<ColorPicker @changePickerColorBen="changeFontSize" :color="color"/>
</div>
</template>
<script lang="ts">
import {defineComponent,ref} from 'vue'
export default defineComponent({
name: 'picker',
setup() {
const color = ref("#ccc")
const changeFontSize = (color: string) => {
console.log("color",color)
}
return {
changeFontSize,
color
}
}
})
</script>