first commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
:: BASE_DOC ::
|
||||
|
||||
## API
|
||||
|
||||
### Transition Props
|
||||
|
||||
name | type | default | description | required
|
||||
-- | -- | -- | -- | --
|
||||
appear | Boolean | false | \- | N
|
||||
destoryOnHide | Boolean | false | \- | N
|
||||
durations | Number / Array | - | Typescript:`number \| number[]` | N
|
||||
name | String | t-transition | \- | N
|
||||
visible | Boolean | false | \- | N
|
||||
45
uni_modules/tdesign-uniapp/components/transition/README.md
Normal file
45
uni_modules/tdesign-uniapp/components/transition/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Transition 过渡
|
||||
description: 过渡组件。
|
||||
spline: message
|
||||
isComponent: true
|
||||
---
|
||||
|
||||
|
||||
## 引入
|
||||
|
||||
### 引入组件
|
||||
|
||||
可在 `main.ts` 或在需要使用的页面或组件中引入。
|
||||
|
||||
```json
|
||||
"usingComponents": {
|
||||
"t-transition": "tdesign-miniprogram/transition/transition"
|
||||
}
|
||||
```
|
||||
|
||||
## 用法
|
||||
|
||||
### 组件方式
|
||||
|
||||
```xml
|
||||
<!-- page.wxml -->
|
||||
<t-transition
|
||||
name="transition-class"
|
||||
visible="{{ visible }}"
|
||||
>
|
||||
<view class="block" style="width: 100px; height: 100px; background: red;"></view>
|
||||
</t-transition>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Transition Props
|
||||
|
||||
名称 | 类型 | 默认值 | 描述 | 必传
|
||||
-- | -- | -- | -- | --
|
||||
appear | Boolean | false | 首次出现是否展示动画 | N
|
||||
destoryOnHide | Boolean | false | 隐藏时是否销毁内容 | N
|
||||
durations | Number / Array | - | 指定过渡时间。TS 类型:`number \| number[]` | N
|
||||
name | String | t-transition | 过渡类名 | N
|
||||
visible | Boolean | false | 是否显示 | N
|
||||
22
uni_modules/tdesign-uniapp/components/transition/props.js
Normal file
22
uni_modules/tdesign-uniapp/components/transition/props.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const props = {
|
||||
appear: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
destoryOnHide: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
durations: {
|
||||
type: null,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: 't-transition',
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
@@ -0,0 +1,14 @@
|
||||
.t-transition-enter {
|
||||
opacity: 0;
|
||||
}
|
||||
.t-transition-enter-to {
|
||||
opacity: 1;
|
||||
transition: opacity 1s;
|
||||
}
|
||||
.t-transition-leave {
|
||||
opacity: 1;
|
||||
}
|
||||
.t-transition-leave-to {
|
||||
opacity: 0;
|
||||
transition: opacity 1s;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<view
|
||||
:class="tClass + ' ' + classPrefix + ' ' + transitionClass"
|
||||
:style="tools._style([visible ? '' : 'display: none', customStyle])"
|
||||
@transitionend="onTransitionEnd"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { uniComponent } from '../common/src/index';
|
||||
import transition from '../mixins/transition';
|
||||
import { prefix } from '../common/config';
|
||||
import tools from '../common/utils.wxs';
|
||||
|
||||
|
||||
const name = `${prefix}-transition`;
|
||||
|
||||
|
||||
export default uniComponent({
|
||||
name,
|
||||
options: {
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
externalClasses: [
|
||||
`${prefix}-class`,
|
||||
],
|
||||
mixins: [transition()],
|
||||
props: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classPrefix: name,
|
||||
tools,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './transition.css';
|
||||
</style>
|
||||
Reference in New Issue
Block a user