iep-ui
Version:
An enterprise-class UI design language and Vue-based implementation
49 lines (44 loc) • 1.24 kB
JavaScript
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import { Sketch } from 'vue-color';
import Tooltip from "../tooltip";
import PropTypes from '../_util/vue-types';
export default {
name: 'AColor',
props: {
value: PropTypes.string
},
inject: {
configProvider: { 'default': function _default() {
return ConfigConsumerProps;
} }
},
render: function render() {
var _this = this;
var h = arguments[0];
var customizePrefixCls = this.prefixCls;
var getPrefixCls = this.configProvider.getPrefixCls;
var prefixCls = getPrefixCls('color', customizePrefixCls);
return h(
'div',
{ 'class': prefixCls },
[h(
Tooltip,
{
attrs: { trigger: 'click', overlayClassName: prefixCls + '-panel' }
},
[h(
'template',
{ slot: 'title' },
[h(Sketch, {
attrs: { value: this.$props.value },
on: {
'input': function input(e) {
return _this.$emit('input', e.hex);
}
}
})]
), h('div', { 'class': prefixCls + '-core', style: { backgroundColor: this.$props.value } })]
)]
);
}
};