原生JS实现的拾色器
需要调用colorpicker.js
html中将个一个div作为容器id设置为color-picker
<div id="color-picker""></div>
js调用插件
Colorpicker.create({
el: "color-picker",
color: "#000fff",
change: function(elem, hex) {
console.log(elem, hex)
}
})
或者
new Colorpicker({
el: "color-picker",
color: "#000fff",
change: function(elem, hex) {
console.log(elem, hex)
}
})