提交
This commit is contained in:
21
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.axml
generated
vendored
Normal file
21
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.axml
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<view
|
||||
class="ant-switch {{className ? className : ''}} ant-switch-{{size}} {{mixin.value ? 'ant-switch-checked' : ''}} {{disabled ? 'ant-switch-disabled' : ''}} {{loading ? 'ant-switch-loading' : ''}}"
|
||||
style="{{mixin.value && color ? 'background:' + color + '; border-color:' + color : ''}};{{style || ''}}"
|
||||
onTap="onChange"
|
||||
>
|
||||
<view class="ant-switch-handle">
|
||||
<ant-icon
|
||||
a:if="{{loading}}"
|
||||
type="UndoOutline"
|
||||
className="ant-switch-loading-icon"
|
||||
></ant-icon>
|
||||
</view>
|
||||
<view class="ant-switch-inner">
|
||||
<block a:if="{{mixin.value}}">
|
||||
<slot name="checkedText">{{checkedText}}</slot>
|
||||
</block>
|
||||
<block a:else>
|
||||
<slot name="uncheckedText">{{uncheckedText}}</slot>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
1
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.d.ts
generated
vendored
Normal file
1
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
17
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.js
generated
vendored
Normal file
17
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
import { Component, triggerEvent } from '../_util/simply';
|
||||
import { SwitchDefaultProps } from './props';
|
||||
import mixinValue from '../mixins/value';
|
||||
Component(SwitchDefaultProps, {
|
||||
onChange: function (e) {
|
||||
var value = !this.getValue();
|
||||
if (!this.isControlled()) {
|
||||
this.update(value);
|
||||
}
|
||||
triggerEvent(this, 'change', value, e);
|
||||
},
|
||||
}, null, [
|
||||
mixinValue({
|
||||
valueKey: 'checked',
|
||||
defaultValueKey: 'defaultChecked',
|
||||
}),
|
||||
]);
|
6
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.json
generated
vendored
Normal file
6
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.json
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"ant-icon": "../Icon/index"
|
||||
}
|
||||
}
|
120
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.less
generated
vendored
Normal file
120
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/index.less
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
@import (reference) './variable.less';
|
||||
|
||||
@switchPrefix: ant-switch;
|
||||
|
||||
@keyframes loading-rotate {
|
||||
100% {
|
||||
transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
|
||||
.@{switchPrefix} {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
align-self: center;
|
||||
min-width: @switch-width;
|
||||
height: @switch-height;
|
||||
border: @switch-border solid @COLOR_BORDER;
|
||||
border-radius: @switch-height * 0.5;
|
||||
background: @COLOR_WHITE;
|
||||
overflow: hidden;
|
||||
line-height: @switch-height;
|
||||
&-checked {
|
||||
background: @switch-fill;
|
||||
border-color: @switch-fill;
|
||||
.@{switchPrefix}-handle {
|
||||
left: calc(100% - (@switch-height - 2 * @switch-border));
|
||||
}
|
||||
.@{switchPrefix}-inner {
|
||||
color: @COLOR_WHITE;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
&-disabled {
|
||||
opacity: 0.4;
|
||||
pointer-events: none;
|
||||
}
|
||||
&-loading {
|
||||
pointer-events: none;
|
||||
|
||||
}
|
||||
&-loading-icon {
|
||||
font-size: 20 * @rpx;
|
||||
animation: loading-rotate 1s linear infinite;
|
||||
color: @COLOR_BRAND1;
|
||||
}
|
||||
&-handle {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: @switch-height - 2 * @switch-border;
|
||||
height: @switch-height - 2 * @switch-border;
|
||||
border-radius: 50%;
|
||||
background: @COLOR_WHITE;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transition: all 200ms;
|
||||
box-shadow: 0 0 2px 0 fade(@COLOR_WHITE_CHANGE_DARK, 20%),
|
||||
0 2px 11.5px 0 fade(@COLOR_WHITE_CHANGE_DARK, 8%),
|
||||
-1px 2px 2px 0 fade(@COLOR_WHITE_CHANGE_DARK, 10%);
|
||||
}
|
||||
&-inner {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
color: @COLOR_TEXT_ASSIST;
|
||||
transition: margin 200ms;
|
||||
font-size: 30 * @rpx;
|
||||
padding: 0 14 * @rpx;
|
||||
min-width: 108 * @rpx;
|
||||
box-sizing: border-box;
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&-small {
|
||||
min-width: @switch-width-small;
|
||||
height: @switch-height-small;
|
||||
border-radius: @switch-height-small * 0.5;
|
||||
.@{switchPrefix}-handle {
|
||||
width: @switch-height-small - 2 * @switch-border;
|
||||
height: @switch-height-small - 2 * @switch-border;
|
||||
}
|
||||
.@{switchPrefix}-inner {
|
||||
font-size: 16 * @rpx;
|
||||
padding: 0 10 * @rpx;
|
||||
min-width: 72 * @rpx;
|
||||
}
|
||||
}
|
||||
&-small&-checked {
|
||||
.@{switchPrefix}-handle {
|
||||
left: calc(100% - (@switch-height-small - 2 * @switch-border));
|
||||
}
|
||||
}
|
||||
|
||||
&-x-small {
|
||||
min-width: @switch-width-x-small;
|
||||
height: @switch-height-x-small;
|
||||
border-radius: @switch-height-x-small * 0.5;
|
||||
.@{switchPrefix}-handle {
|
||||
width: @switch-height-x-small - 2 * @switch-border;
|
||||
height: @switch-height-x-small - 2 * @switch-border;
|
||||
}
|
||||
.@{switchPrefix}-inner {
|
||||
font-size: 10 * @rpx;
|
||||
padding: 0 6 * @rpx;
|
||||
min-width: 56 * @rpx;
|
||||
}
|
||||
}
|
||||
&-x-small&-checked {
|
||||
.@{switchPrefix}-handle {
|
||||
left: calc(100% - (@switch-height-x-small - 2 * @switch-border));
|
||||
}
|
||||
}
|
||||
}
|
44
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/props.d.ts
generated
vendored
Normal file
44
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/props.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
import { IBaseProps } from '../_util/base';
|
||||
/**
|
||||
* @description 开关。
|
||||
*/
|
||||
export interface ISwitchProps extends IBaseProps {
|
||||
/**
|
||||
* @description 是否勾选
|
||||
*/
|
||||
checked?: boolean;
|
||||
/**
|
||||
* @description 是否加载状态
|
||||
*/
|
||||
loading?: boolean;
|
||||
/**
|
||||
* @description 选中时的颜色
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* @description 选中时的内容
|
||||
*/
|
||||
checkedText?: string;
|
||||
/**
|
||||
* @description 非选中时的内容
|
||||
*/
|
||||
uncheckedText?: string;
|
||||
/**
|
||||
* @default medium
|
||||
* @description 尺寸
|
||||
*/
|
||||
size?: 'medium' | 'small' | 'x-small';
|
||||
/**
|
||||
* 是否禁用
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* 初始值
|
||||
*/
|
||||
defaultChecked?: boolean;
|
||||
/**
|
||||
* @description 修改回调方法
|
||||
*/
|
||||
onChange?: (checked: boolean, e: Record<string, any>) => void;
|
||||
}
|
||||
export declare const SwitchDefaultProps: Partial<ISwitchProps>;
|
10
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/props.js
generated
vendored
Normal file
10
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/props.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export var SwitchDefaultProps = {
|
||||
checked: null,
|
||||
loading: false,
|
||||
color: '',
|
||||
checkedText: '',
|
||||
uncheckedText: '',
|
||||
size: 'medium',
|
||||
disabled: false,
|
||||
defaultChecked: false,
|
||||
};
|
24
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/variable.less
generated
vendored
Normal file
24
甲情_甲意/miniprogram/node_modules/antd-mini/less/Switch/variable.less
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
@import (reference) '../style/themes/index.less';
|
||||
|
||||
// 激活时颜色
|
||||
@switch-fill: @COLOR_BRAND1;
|
||||
// 开关宽度
|
||||
@switch-width: 102 * @rpx;
|
||||
// 开关高度
|
||||
@switch-height: 62 * @rpx;
|
||||
// 开关边框
|
||||
@switch-border: 4 * @rpx;
|
||||
|
||||
// 开关宽度
|
||||
@switch-width-small: 72 * @rpx;
|
||||
// 开关高度
|
||||
@switch-height-small: 42 * @rpx;
|
||||
// 开关边框
|
||||
@switch-border-small: 3 * @rpx;
|
||||
|
||||
// 开关宽度
|
||||
@switch-width-x-small: 52 * @rpx;
|
||||
// 开关高度
|
||||
@switch-height-x-small: 32 * @rpx;
|
||||
// 开关边框
|
||||
@switch-border-x-small: 2 * @rpx;
|
Reference in New Issue
Block a user