types(Toast): add Toast method typing (#8095)

This commit is contained in:
neverland
2021-02-07 10:24:20 +08:00
committed by GitHub
parent 7332e5201c
commit 02669ad025
3 changed files with 192 additions and 164 deletions
+5 -4
View File
@@ -30,8 +30,9 @@
</demo-block>
</template>
<script>
<script lang="ts">
import { useTranslate } from '@demo/use-translate';
import type { LoadingType } from '../../loading';
import Toast from '..';
const i18n = {
@@ -40,7 +41,7 @@ const i18n = {
text: '提示内容',
text2: '成功文案',
text3: '失败文案',
text4: (second) => `倒计时 ${second}`,
text4: (second: number) => `倒计时 ${second}`,
title1: '文字提示',
title2: '加载提示',
title3: '成功/失败提示',
@@ -58,7 +59,7 @@ const i18n = {
text: 'Some messages',
text2: 'Success',
text3: 'Fail',
text4: (second) => `${second} seconds`,
text4: (second: number) => `${second} seconds`,
title1: 'Text',
title2: 'Loading',
title3: 'Success/Fail',
@@ -77,7 +78,7 @@ export default {
setup() {
const t = useTranslate(i18n);
const showLoadingToast = (loadingType) => {
const showLoadingToast = (loadingType: LoadingType) => {
Toast.loading({
forbidClick: true,
message: t('loading'),