-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1003 from ksc-fe/revision-menu
add button props and fix table hidden
- Loading branch information
Showing
48 changed files
with
999 additions
and
748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: 定义switch切换前的拦截函数 | ||
order: 8 | ||
--- | ||
|
||
给`Switch`添加`beforeChange`函数,来定义开关切换之前的逻辑,如果该函数返回`true`则成功切换,否则忽略本次切换 | ||
|
||
> 支持异步函数 | ||
```vdt | ||
import {Switch} from 'kpc'; | ||
<div> | ||
<Switch v-model="value1" beforeChange={this.beforeChange} /> | ||
<Switch v-model="value2" beforeChange={this.beforeChangeFalse} /> | ||
</div> | ||
``` | ||
|
||
```styl | ||
.k-switch | ||
margin-right 20px | ||
``` | ||
|
||
```ts | ||
import { Message } from 'kpc'; | ||
export default class extends Component { | ||
static template = template; | ||
static defaults() { | ||
return { | ||
value1: false, | ||
value2: false, | ||
} | ||
} | ||
|
||
beforeChange(value: any) { | ||
return new Promise<boolean>(resolve => { | ||
Message.warning(`current value is ${value}`); | ||
setTimeout(() => { | ||
resolve(true); | ||
}, 1000); | ||
}); | ||
} | ||
beforeChangeFalse(value: any) { | ||
Message.warning(`current value is ${value}`); | ||
return new Promise<boolean>(resolve => { | ||
setTimeout(() => { | ||
resolve(false); | ||
}, 1000); | ||
}); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.