mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
chore(Slider): format code (#10055)
This commit is contained in:
parent
3976d5583d
commit
8fd2c0570e
@ -168,11 +168,11 @@ export default {
|
||||
|
||||
### Slots
|
||||
|
||||
| Name | Description | Arguments |
|
||||
| ------------ | ------------------------------ | ----------------- |
|
||||
| button | Custom button | - |
|
||||
| left-button | Custom left button (in range) | { value: number } |
|
||||
| right-button | Custom right button (in range) | { value: number } |
|
||||
| Name | Description | Arguments |
|
||||
| ----------------------- | ------------------------------ | ----------------- |
|
||||
| button | Custom button | - |
|
||||
| left-button `v2.12.38` | Custom left button (in range) | { value: number } |
|
||||
| right-button `v2.12.38` | Custom right button (in range) | { value: number } |
|
||||
|
||||
### Less Variables
|
||||
|
||||
|
@ -174,11 +174,11 @@ export default {
|
||||
|
||||
### Slots
|
||||
|
||||
| 名称 | 说明 | 参数 |
|
||||
| ------------ | ---------------------------------- | ----------------- |
|
||||
| button | 自定义滑动按钮 | - |
|
||||
| left-button | 自定义左侧滑块按钮(双滑块模式下) | { value: number } |
|
||||
| right-button | 自定义右侧滑块按钮(双滑块模式下) | { value: number } |
|
||||
| 名称 | 说明 | 参数 |
|
||||
| --- | --- | --- |
|
||||
| button | 自定义滑动按钮 | - |
|
||||
| left-button `v2.12.38` | 自定义左侧滑块按钮(双滑块模式下) | { value: number } |
|
||||
| right-button `v2.12.38` | 自定义右侧滑块按钮(双滑块模式下) | { value: number } |
|
||||
|
||||
### 样式变量
|
||||
|
||||
|
@ -236,33 +236,38 @@ export default createComponent({
|
||||
const renderButton = (i) => {
|
||||
const map = ['left', 'right'];
|
||||
const isNumber = typeof i === 'number';
|
||||
const current = isNumber ? this.value[i] : this.value
|
||||
const current = isNumber ? this.value[i] : this.value;
|
||||
|
||||
const getClassName = () => {
|
||||
if (isNumber) {
|
||||
return `button-wrapper-${map[i]}`;
|
||||
}
|
||||
return `button-wrapper`;
|
||||
};
|
||||
|
||||
const getRefName = () => {
|
||||
if (isNumber) {
|
||||
return `wrapper${i}`;
|
||||
}
|
||||
return `wrapper`;
|
||||
};
|
||||
|
||||
const renderButtonContent = () => {
|
||||
if (isNumber) {
|
||||
const slot = this.slots(i === 0 ? 'left-button' : 'right-button', {value: current})
|
||||
const slot = this.slots(i === 0 ? 'left-button' : 'right-button', {
|
||||
value: current,
|
||||
});
|
||||
if (slot) {
|
||||
return slot
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.slots('button')) {
|
||||
return this.slots('button')
|
||||
return this.slots('button');
|
||||
}
|
||||
return (
|
||||
<div class={bem('button')} style={this.buttonStyle} />
|
||||
)
|
||||
}
|
||||
|
||||
return <div class={bem('button')} style={this.buttonStyle} />;
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
|
Loading…
x
Reference in New Issue
Block a user