-
- Notifications
You must be signed in to change notification settings - Fork 3.9k
feat:add color-picker component #2178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| model: { | ||
| prop: 'value', | ||
| event: 'change', | ||
| event: 'myChange',//为了支持v-model直接返回颜色字符串 所以用了自定义的事件,与pickr自带change事件进行区分 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
名称改成 change.value 吧
| }, | ||
| methods: { | ||
| eventsBinding() { | ||
| Object.keys(this.$listeners).forEach(event => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是所有的事件都绑定到 picker 吧 如果绑定了picker本身不支持的会不会有问题 例如 click dbclick ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的 那我维护个事件数组
| onClick={this.handleOpenChange.bind(this, !this.myOpen)} | ||
| {...props} | ||
| onClick={this.handleOpenChange} | ||
| {...this.$attrs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个也没必要加 vue会自动将没有声明的属性,挂载到根结点上 ,除非明确声明了 inheritAttrs: false
| save: 'Save', | ||
| clear: 'Clear', | ||
| cancel: 'Cancel', | ||
| save: '保存', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
繁体字 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我查了下,这几个的繁体 也是长这样的
| @import '../../style/themes/index'; | ||
| @import '../../input/style/mixin'; | ||
| | ||
| @import '../../../node_modules/@simonwep/pickr/dist/themes/classic.min.css'; // 'classic' theme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥用相对路径,
这种支持的吧 @import '~@simonwep/pickr/dist/themes/classic.min.css';
| prefixCls: PropTypes.string, | ||
| defaultValue:PropTypes.string,//默认值 | ||
| config: PropTypes.object,//pickr配置 | ||
| value: PropTypes.string,//颜色值 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1、外层value 变化,没有响应
watch: {
value(val) {
picker.setColor
}
}
2、还有 config 的数据变化后如何同步?
3、新增 diable、color-format(参考element) 的属性
| pickr: null, | ||
| }; | ||
| }, | ||
| mounted() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
组件销毁后 picker 实例要同步销毁
| 'large': `${prefixCls}-lg`, | ||
| 'small': `${prefixCls}-sm`, | ||
| }; | ||
| if (sizeOpt[this.size]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这部分的逻辑是不是可以直接写到 classString 的声明中
| This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
First of all, thank you for your contribution! 😄
New feature please send pull request to feature branch, and rest to master branch. Pull request will be merged after one of collaborators approve. Please makes sure that these form are filled before submitting your pull request, thank you!
[中文版模板 / Chinese template]
This is a ...
What's the background?
API Realization (Optional if not new feature)
What's the effect? (Optional if not new feature)
Changelog description (Optional if not new feature)
Self Check before Merge
Additional Plan? (Optional if not new feature)