New Huajishe Check ChaoXing
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
## API
|
||||
|
||||
|
||||
### Overlay Props
|
||||
|
||||
name | type | default | description | required
|
||||
-- | -- | -- | -- | --
|
||||
style | Object | - | CSS(Cascading Style Sheets) | N
|
||||
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
|
||||
background-color | String | - | \- | N
|
||||
duration | Number | 300 | \- | N
|
||||
prevent-scroll-through | Boolean | true | \- | N
|
||||
using-custom-navbar | Boolean | false | \- | N
|
||||
visible | Boolean | false | \- | N
|
||||
z-index | Number | 11000 | \- | N
|
||||
|
||||
### Overlay Events
|
||||
|
||||
name | params | description
|
||||
-- | -- | --
|
||||
click | `({ visible: boolean })` | \-
|
||||
|
||||
|
||||
### CSS Variables
|
||||
|
||||
The component provides the following CSS variables, which can be used to customize styles.
|
||||
Name | Default Value | Description
|
||||
-- | -- | --
|
||||
--td-overlay-bg-color | @font-gray-2 | -
|
||||
--td-overlay-transition-duration | 300ms | -
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
title: Overlay 遮罩层
|
||||
description: 通过遮罩层,可以强调部分内容
|
||||
spline: message
|
||||
isComponent: true
|
||||
---
|
||||
|
||||
<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20functions-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20statements-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-100%25-blue" /></span>
|
||||
|
||||
<div style="background: #ecf2fe; display: flex; align-items: center; line-height: 20px; padding: 14px 24px; border-radius: 3px; color: #555a65">
|
||||
<svg fill="none" viewBox="0 0 16 16" width="16px" height="16px" style="margin-right: 5px">
|
||||
<path fill="#0052d9" d="M8 15A7 7 0 108 1a7 7 0 000 14zM7.4 4h1.2v1.2H7.4V4zm.1 2.5h1V12h-1V6.5z" fillOpacity="0.9"></path>
|
||||
</svg>
|
||||
该组件于 0.10.0 版本上线,请留意版本。
|
||||
</div>
|
||||
|
||||
## 引入
|
||||
|
||||
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
|
||||
|
||||
```json
|
||||
"usingComponents": {
|
||||
"t-overlay": "tdesign-miniprogram/overlay/overlay"
|
||||
}
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
<a href="https://developers.weixin.qq.com/s/nS8fQimZ7cSG" title="在开发者工具中预览效果" target="_blank" rel="noopener noreferrer"> 在开发者工具中预览效果 </a>
|
||||
|
||||
<blockquote style="background-color: #d9e1ff; font-size: 15px; line-height: 26px;margin: 16px 0 0;padding: 16px; border-radius: 6px; color: #0052d9" >
|
||||
<p>Tips: 请确保开发者工具为打开状态。导入开发者工具后,依次执行:npm i > 构建npm包 > 勾选 "将JS编译成ES5"</p>
|
||||
</blockquote>
|
||||
|
||||
### 基础使用
|
||||
|
||||
{{ base }}
|
||||
|
||||
## API
|
||||
|
||||
### Overlay Props
|
||||
|
||||
名称 | 类型 | 默认值 | 描述 | 必传
|
||||
-- | -- | -- | -- | --
|
||||
style | Object | - | 样式 | N
|
||||
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
|
||||
background-color | String | - | 遮罩层的背景色 | N
|
||||
duration | Number | 300 | 背景色过渡时间,单位毫秒 | N
|
||||
prevent-scroll-through | Boolean | true | 防止滚动穿透,即不允许点击和滚动 | N
|
||||
using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
|
||||
visible | Boolean | false | 是否展示 | N
|
||||
z-index | Number | 11000 | 遮罩层级 | N
|
||||
|
||||
### Overlay Events
|
||||
|
||||
名称 | 参数 | 描述
|
||||
-- | -- | --
|
||||
click | `({ visible: boolean })` | 点击遮罩时触发
|
||||
|
||||
### CSS Variables
|
||||
|
||||
组件提供了下列 CSS 变量,可用于自定义样式。
|
||||
名称 | 默认值 | 描述
|
||||
-- | -- | --
|
||||
--td-overlay-bg-color | @font-gray-2 | -
|
||||
--td-overlay-transition-duration | 300ms | -
|
||||
3
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/index.d.ts
vendored
Normal file
3
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './props';
|
||||
export * from './type';
|
||||
export * from './overlay';
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './props';
|
||||
export * from './type';
|
||||
export * from './overlay';
|
||||
22
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/overlay.d.ts
vendored
Normal file
22
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/overlay.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { SuperComponent } from '../common/src/index';
|
||||
import { TdOverlayProps } from './type';
|
||||
export interface OverlayProps extends TdOverlayProps {
|
||||
}
|
||||
export default class Overlay extends SuperComponent {
|
||||
properties: TdOverlayProps;
|
||||
behaviors: string[];
|
||||
data: {
|
||||
prefix: string;
|
||||
classPrefix: string;
|
||||
computedStyle: string;
|
||||
_zIndex: number;
|
||||
};
|
||||
observers: {
|
||||
backgroundColor(v: any): void;
|
||||
zIndex(v: any): void;
|
||||
};
|
||||
methods: {
|
||||
handleClick(): void;
|
||||
noop(): void;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
import { SuperComponent, wxComponent } from '../common/src/index';
|
||||
import config from '../common/config';
|
||||
import props from './props';
|
||||
import transition from '../mixins/transition';
|
||||
import useCustomNavbar from '../mixins/using-custom-navbar';
|
||||
const { prefix } = config;
|
||||
const name = `${prefix}-overlay`;
|
||||
let Overlay = class Overlay extends SuperComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.properties = props;
|
||||
this.behaviors = [transition(), useCustomNavbar];
|
||||
this.data = {
|
||||
prefix,
|
||||
classPrefix: name,
|
||||
computedStyle: '',
|
||||
_zIndex: 11000,
|
||||
};
|
||||
this.observers = {
|
||||
backgroundColor(v) {
|
||||
this.setData({
|
||||
computedStyle: v ? `background-color: ${v};` : '',
|
||||
});
|
||||
},
|
||||
zIndex(v) {
|
||||
if (v !== 0) {
|
||||
this.setData({
|
||||
_zIndex: v,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
this.methods = {
|
||||
handleClick() {
|
||||
this.triggerEvent('click', { visible: !this.properties.visible });
|
||||
},
|
||||
noop() { },
|
||||
};
|
||||
}
|
||||
};
|
||||
Overlay = __decorate([
|
||||
wxComponent()
|
||||
], Overlay);
|
||||
export default Overlay;
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<wxs src="../common/utils.wxs" module="_" />
|
||||
|
||||
<view
|
||||
wx:if="{{realVisible && preventScrollThrough}}"
|
||||
class="{{prefix}}-overlay {{transitionClass}} class"
|
||||
style="{{_._style(['--td-overlay-transition-duration:' + duration + 'ms', 'z-index:' + _zIndex, 'top:' + distanceTop + 'px', computedStyle, style, customStyle])}}"
|
||||
bind:tap="handleClick"
|
||||
catchtouchmove="noop"
|
||||
bind:transitionend="onTransitionEnd"
|
||||
aria-role="{{ ariaRole || 'button' }}"
|
||||
aria-label="{{ ariaLabel || '关闭' }}"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
<view
|
||||
wx:elif="{{realVisible}}"
|
||||
class="{{prefix}}-overlay {{transitionClass}} class"
|
||||
style="{{_._style(['z-index:' + _zIndex, computedStyle, style, customStyle])}}"
|
||||
bind:tap="handleClick"
|
||||
bind:transitionend="onTransitionEnd"
|
||||
aria-role="{{ ariaRole || 'button' }}"
|
||||
aria-label="{{ ariaLabel || '关闭' }}"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
@@ -0,0 +1,44 @@
|
||||
.t-float-left {
|
||||
float: left;
|
||||
}
|
||||
.t-float-right {
|
||||
float: right;
|
||||
}
|
||||
@keyframes tdesign-fade-out {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.hotspot-expanded.relative {
|
||||
position: relative;
|
||||
}
|
||||
.hotspot-expanded::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transform: scale(1.5);
|
||||
}
|
||||
.t-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
background-color: var(--td-overlay-bg-color, var(--td-font-gray-2, rgba(0, 0, 0, 0.6)));
|
||||
transition-property: opacity;
|
||||
transition-duration: var(--td-overlay-transition-duration, 300ms);
|
||||
transition-timing-function: ease;
|
||||
}
|
||||
.t-fade-enter {
|
||||
opacity: 0;
|
||||
}
|
||||
.t-fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
3
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/props.d.ts
vendored
Normal file
3
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/props.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { TdOverlayProps } from './type';
|
||||
declare const props: TdOverlayProps;
|
||||
export default props;
|
||||
@@ -0,0 +1,19 @@
|
||||
const props = {
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 300,
|
||||
},
|
||||
preventScrollThrough: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 11000,
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
26
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/type.d.ts
vendored
Normal file
26
HuajisheCheckChaoXing/miniprogram_npm/tdesign-miniprogram/overlay/type.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface TdOverlayProps {
|
||||
backgroundColor?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
duration?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
preventScrollThrough?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
usingCustomNavbar?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
visible?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
zIndex?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user