el-color-picker-sheldon使用说明(一款基于Vue和ElementUI的取色器)

el-color-picker-sheldon使用说明(一款基于Vue和ElementUI的取色器)

Introduction 简介

在这里插入图片描述

This is a color picker component based on vue and element-ui. It is powerful and supports drag and drop, color picking and other functions.

这是一个基于 vue 和 element-ui 的取色器组件,功能强大,支持拖拽、取色等功能。

Functions 功能点

  1. Show a gradient palette with all colors and adjustable transparency 展示一个有所有颜色并且可以调节透明度的渐变调色板

  2. Click on the palette to get the selected color, and display the corresponding hex value or rgba value in real time 点击调色板获取选中的颜色,并且实时显示对应 hex 值或者 rgba 值

  3. Modify the hex value or rgba value, and display the corresponding color in real time 修改 hex 值或者 rgba 值,实时显示对应的颜色

  4. You can set whether the color picker can be dragged 可以设置取色器是否可拖动

  5. Send the current color to the parent component 发送当前的颜色给父组件

Install 安装

npm install el-color-picker-sheldon

Usage 用法

  1. Introduce the required element-ui components in main.js or plugins/element.js 在 main.js 或者 plugins/element.js 中按需引入 element-ui 组件(也可以直接引入整个element-ui):
import Vue from 'vue';
import {Slider,Switch,Row,Col,Button,Input,Message,MessageBox} from 'element-ui'
Vue.use(Slider)
Vue.use(Switch)
Vue.use(Row)
Vue.use(Col)
Vue.use(Button)
Vue.use(Input)
Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm
import 'element-ui/lib/theme-chalk/index.css';
  1. Partial introduction of components 局部引入组件
<template>
	<div>
		<div>{{colorValue}}</div>
		<color-picker :draggable="false" @receiveColor="receiveColor"></color-picker>
	</div>
<template>
<script>
import ColorPicker from 'el-color-picker-sheldon'

export default {
	components:{
		ColorPicker
	},
	data () {
	 	return {
			colorValue:''
		}
	}
	methods:{
		// get color value 获取取色器的颜色
	    receiveColor(colorValue){
	      this.colorValue = colorValue
	    },
	}
}

如果遇到使用上的问题,或者有任何好的改进建议,欢迎在评论下留言。

纯vue版本的取色器

鉴于有的同学可能使用 Ant Design Vue 等其他UI框架,所以新出了一款不包含任何UI框架的取色器插件,样式几乎相同,功能一致。
vue-color-picker-sheldon使用说明(一款基于Vue的取色器/颜色选择器)

CSDN 地址

el-color-picker-sheldon使用说明(一款基于Vue和ElementUI的取色器)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Sheldon一蓑烟雨任平生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值