Skip to content
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

feat(slider): 增加小数滑块 #1794

Closed
wants to merge 2 commits into from
Closed

Conversation

Diyar-IT
Copy link
Contributor

@Diyar-IT Diyar-IT commented Apr 16, 2024

😃 本次 PR 的变化性质

请至少勾选一项

  • 功能新增
  • 问题修复
  • 功能优化
  • 分支合并
  • 其他改动:请在此处填写

🌱 本次 PR 的变化内容

效果:
微信截图_20240416090537

✅ 本次 PR 的满足条件

请在申请合并之前,将符合条件的每一项进行勾选

  • 已提供在线演示地址(如:codepen, stackblitz)或无需演示
  • 已对每一项的改动均测试通过
  • 已提供具体的变化内容说明

Copy link

stackblitz bot commented Apr 16, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sentsim sentsim requested a review from Sight-wcg April 16, 2024 11:48
@sentsim sentsim changed the title 增加小数滑块 feat(slider): 增加小数滑块 Apr 16, 2024
@sentsim
Copy link
Member

sentsim commented Apr 16, 2024

@Diyar-IT 后续 PR 标题及 Commit message 按照统一格式规范书写,可大致遵循 Angular 团队的 Commit 规范即可。

<type>(<scope>): <subject>
  • type: commit 的类型
  • scope: commit 影响的范围
  • subject: commit 的简短描述

如:feat(slider): 增加小数滑块

Copy link
Collaborator

@Sight-wcg Sight-wcg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当设置 type: 'vertical'range: true 时,效果不符合预期,同时建议用一个选项来设置是否开启此效果。
image

@@ -113,11 +113,15 @@ layui.define(['jquery', 'lay'], function(exports){
//间隔值不能小于等于 0
if(options.step <= 0) options.step = 1;

if (options.min < 0 && options.step >= 1) options.step = 0.01;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要将 step 设置为 0.01?

@@ -319,7 +386,26 @@ layui.define(['jquery', 'lay'], function(exports){
if(options.type === 'vertical'){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当设置 type: 'vertical' 时,效果和 type: 'default' 不一致

var scale = (options.value - options.min) / (options.max - options.min) * 100 + '%';
scale = (options.value - options.min) / (options.max - options.min) * 100;

if (options.min < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

range: true 时应该不需要处理滑块偏移

style.push('height:' + scale);
style.push('bottom:' + (scaleFir || 0));
} else {
if (options.min < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

range: true 时应该不需要处理滑块偏移

@@ -319,7 +386,26 @@ layui.define(['jquery', 'lay'], function(exports){
if(options.type === 'vertical'){
sliderAct.find('.' + SLIDER_BAR).css({"height":wrapWidth + '%', "bottom":minLeft + '%'});
}else{
sliderAct.find('.' + SLIDER_BAR).css({"width":wrapWidth + '%', "left":minLeft + '%'});
if (options.min < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

range: true 时应该不需要处理滑块偏移

Copy link
Member

@sentsim sentsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Diyar-IT 有空记得将晨星上述的 Review 逐一处理。

@sentsim sentsim marked this pull request as draft April 25, 2024 09:38
@Diyar-IT
Copy link
Contributor Author

Diyar-IT commented May 2, 2024

@Diyar-IT 有空记得将晨星上述的 Review 逐一处理。
好的,最近有一点忙,有空就优惠代码。。。

@sentsim
Copy link
Member

sentsim commented May 23, 2024

由于该 PR 超过一个月未按照要求更改,先做关闭。
后续若有更好的优化方案,欢迎再次提交。

@sentsim sentsim closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants