提交 1b60bd23 编写于 作者: Y yurj26

chore: remove warning

上级 47d2beb8
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view class="uni-btn-v">
<button class="uni-btn-v" type="default" @tap="toast1Tap">点击弹出默认toast</button>
<button class="uni-btn-v" type="default" @tap="toastTapIconError">点击弹出设置icon的toast</button>
<button class="uni-btn-v" type="default" @tap="toast2Tap">点击弹出设置duration的toast</button>
<button class="uni-btn-v" type="default" @tap="toast3Tap">点击弹出显示loading的toast</button>
<!-- #ifndef MP-ALIPAY -->
<button class="uni-btn-v" type="default" @tap="toast4Tap">点击弹出显示自定义图片的toast</button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<button class="uni-btn-v" type="default" @tap="toast5Tap">点击显示无图标的居底toast</button>
<!-- #endif -->
<button class="uni-btn-v" type="default" @tap="hideToast">点击隐藏toast</button>
</view>
<text>{{exeRet}}</text>
</view>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view class="uni-btn-v">
<button class="uni-btn-v" type="default" @tap="toast1Tap">点击弹出默认toast</button>
<button class="uni-btn-v" type="default" @tap="toastTapIconError">点击弹出设置icon的toast</button>
<button class="uni-btn-v" type="default" @tap="toast2Tap">点击弹出设置duration的toast</button>
<button class="uni-btn-v" type="default" @tap="toast3Tap">点击弹出显示loading的toast</button>
<!-- #ifndef MP-ALIPAY -->
<button class="uni-btn-v" type="default" @tap="toast4Tap">点击弹出显示自定义图片的toast</button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<button class="uni-btn-v" type="default" @tap="toast5Tap">点击显示无图标的居底toast</button>
<!-- #endif -->
<button class="uni-btn-v" type="default" @tap="hideToast">点击隐藏toast</button>
</view>
<text>{{exeRet}}</text>
</view>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
title: 'toast',
exeRet:'',
_showTimer: 0
}
},
// #ifdef MP-ALIPAY
onUnload() {
clearTimeout(this._showTimer);
},
// #endif
methods: {
toast1Tap: function () {
uni.showToast({
title: "默认",
success:function(res){
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail:function(res){
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
toastTapIconError: function () {
uni.showToast({
title: "默认",
icon:'error',
success:function(res){
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail:function(res){
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
toast2Tap: function () {
uni.showToast({
title: "duration 3000",
duration: 3000,
success:function(res){
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail:function(res){
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
toast3Tap: function () {
uni.showToast({
title: "loading",
icon: "loading",
duration: 5000,
success:function(res){
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail:function(res){
this.exeRet = "fail:" + JSON.stringify(res)
},
})
// #ifdef MP-ALIPAY
this._showTimer = setTimeout(() => {
// icon 是 loading 时,showToast 实际执行的是 showLoading
my.hideLoading()
// 执行完所有代码再清除定时器
clearTimeout(this._showTimer);
}, 3000)
// #endif
},
toast4Tap: function () {
uni.showToast({
title: "logo",
image: "/static/uni.png",
success:function(res){
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail:function(res){
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
// #ifdef APP-PLUS
toast5Tap: function () {
uni.showToast({
title: "显示一段轻提示",
position: 'bottom',
success:function(res){
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail:function(res){
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
// #endif
hideToast: function () {
uni.hideToast()
}
}
export default {
data() {
return {
title: 'toast',
exeRet: ''
}
},
methods: {
toast1Tap: function () {
uni.showToast({
title: "默认",
success: function (res) {
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail: function (res) {
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
toastTapIconError: function () {
uni.showToast({
title: "默认",
icon: 'error',
success: function (res) {
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail: function (res) {
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
toast2Tap: function () {
uni.showToast({
title: "duration 3000",
duration: 3000,
success: function (res) {
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail: function (res) {
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
toast3Tap: function () {
uni.showToast({
title: "loading",
icon: "loading",
duration: 5000,
success: function (res) {
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail: function (res) {
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
toast4Tap: function () {
uni.showToast({
title: "logo",
image: "/static/uni.png",
success: function (res) {
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail: function (res) {
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
// #ifdef APP-PLUS
toast5Tap: function () {
uni.showToast({
title: "显示一段轻提示",
position: 'bottom',
success: function (res) {
this.exeRet = "success:" + JSON.stringify(res) + new Date()
},
fail: function (res) {
this.exeRet = "fail:" + JSON.stringify(res)
},
})
},
// #endif
hideToast: function () {
uni.hideToast()
}
}
</script>
\ No newline at end of file
}
</script>
......@@ -47,7 +47,6 @@
type ListItem = {
id : string
name : string
open : boolean
pages : Page[]
url ?: string
enable ?: boolean
......@@ -59,7 +58,6 @@
{
id: 'global',
name: '全局',
open: false,
pages: [
{
name: 'getApp',
......@@ -74,7 +72,6 @@
{
id: 'base',
name: '基础',
open: false,
pages: [
{
name: '事件总线event-bus',
......@@ -94,7 +91,6 @@
{
id: 'page',
name: '页面和路由',
open: false,
pages: [
{
name: '页面跳转',
......@@ -162,7 +158,6 @@
{
id: 'ui',
name: '界面',
open: false,
pages: [
/* {
name: "创建动画",
......@@ -211,7 +206,6 @@
{
id: 'device',
name: '设备',
open: false,
pages: [
{
name: '获取系统信息',
......@@ -298,7 +292,6 @@
{
id: 'media',
name: '媒体',
open: false,
pages: [
{
name: "图片",
......@@ -399,7 +392,6 @@
id: "rewarded-video-ad",
url: "rewarded-video-ad",
name: "激励视频广告",
open: false,
enable: false,
pages: [] as Page[]
},
......@@ -407,14 +399,12 @@
id: "full-screen-video-ad",
url: "full-screen-video-ad",
name: "全屏视频广告",
open: false,
enable: false,
pages: [] as Page[]
},
{
id: "login",
name: "登录",
open: false,
pages: [
{
name: "登录",
......@@ -429,7 +419,6 @@
{
id: "share",
name: "分享",
open: false,
pages: [
{
name: "分享",
......@@ -440,7 +429,6 @@
{
id: "payment",
name: "支付",
open: false,
pages: [
{
name: "发起支付",
......@@ -451,7 +439,6 @@
{
id: "speech",
name: "语音",
open: false,
pages: [
{
name: "语音识别",
......@@ -462,7 +449,6 @@
{
id: "push",
name: "推送",
open: false,
pages: [
{
name: "推送",
......@@ -477,24 +463,6 @@
}
},
methods: {
triggerCollapse(index ?: number, item : ListItem) {
if (item.pages.length == 0) {
const page : Page = {
name: item.name,
enable: item.enable,
url: item.url!,
}
this.goDetailPage(page)
return
}
for (var i = 0; i < this.list.length; ++i) {
if (index == i) {
this.list[i].open = !this.list[i].open
} else {
this.list[i].open = false
}
}
},
goDetailPage(e : Page) {
if (e.enable == false) {
uni.showToast({
......
......@@ -38,7 +38,6 @@
type ListItem = {
id : string
name : string
open : boolean
pages : Page[]
url ?: string
enable ?: boolean
......@@ -50,7 +49,6 @@
{
id: 'background',
name: 'background',
open: false,
pages: [
{
name: 'background-color',
......@@ -65,7 +63,6 @@
{
id: 'border',
name: 'border',
open: false,
pages: [
{
name: 'border',
......@@ -96,7 +93,6 @@
{
id: 'box-shadow',
name: 'box-shadow',
open: false,
pages: [
{
name: 'box-shadow',
......@@ -107,7 +103,6 @@
{
id: 'display',
name: 'display',
open: false,
pages: [
{
name: 'flex',
......@@ -122,7 +117,6 @@
{
id: 'flex',
name: 'flex',
open: false,
pages: [
{
name: 'align-content',
......@@ -165,7 +159,6 @@
{
id: 'layout',
name: 'layout',
open: false,
pages: [
{
name: 'height',
......@@ -208,7 +201,6 @@
{
id: 'margin',
name: 'margin',
open: false,
pages: [
{
name: 'margin-bottom',
......@@ -235,7 +227,6 @@
{
id: 'padding',
name: 'padding',
open: false,
pages: [
{
name: 'padding-bottom',
......@@ -262,7 +253,6 @@
{
id: 'text',
name: 'text',
open: false,
pages: [
{
name: 'color',
......@@ -309,7 +299,6 @@
{
id: 'transform',
name: 'transform',
open: false,
pages: [
{
name: 'translate',
......@@ -328,7 +317,6 @@
{
id: 'transition',
name: 'transition',
open: false,
pages: [
{
name: 'transition',
......@@ -343,24 +331,6 @@
}
},
methods: {
triggerCollapse(index ?: number, item : ListItem) {
if (item.pages.length == 0) {
const page : Page = {
name: item.name,
enable: item.enable,
url: item.url,
}
this.goDetailPage(page)
return
}
for (var i = 0; i < this.list.length; ++i) {
if (index == i) {
this.list[i].open = !this.list[i].open
} else {
this.list[i].open = false
}
}
},
goDetailPage(e : Page) {
if (e.enable == false) {
uni.showToast({
......@@ -384,4 +354,4 @@
.item {
margin-bottom: 12px;
}
</style>
\ No newline at end of file
</style>
......@@ -54,7 +54,6 @@ type Page = {
type ListItem = {
id : string
name : string
open : boolean
pages : Page[]
url ?: string
enable ?: boolean
......@@ -66,7 +65,6 @@ export default {
{
id: 'view',
name: '视图容器',
open: false,
pages: [
{
name: 'view',
......@@ -95,7 +93,6 @@ export default {
{
id: 'content',
name: '基础内容',
open: false,
pages: [
{
name: 'text',
......@@ -112,7 +109,6 @@ export default {
{
id: 'form',
name: '表单组件',
open: false,
pages: [
{
name: 'button',
......@@ -162,7 +158,6 @@ export default {
{
id: 'nav',
name: '导航',
open: false,
pages: [{
name: 'navigator',
enable: true
......@@ -171,7 +166,6 @@ export default {
{
id: 'media',
name: '媒体组件',
open: false,
pages: [
{
name: 'image',
......@@ -191,7 +185,6 @@ export default {
{
id: 'map',
name: '地图',
open: false,
pages: [
{
name: 'map',
......@@ -202,7 +195,6 @@ export default {
{
id: 'canvas',
name: '画布',
open: false,
pages: [
{
name: 'canvas'
......@@ -213,7 +205,6 @@ export default {
{
id: 'web-view',
name: '网页',
open: false,
pages: [
{
name: '网络网页',
......@@ -233,14 +224,12 @@ export default {
url: 'ad',
name: 'AD组件',
enable: false,
open: false,
pages: [] as Page[]
}
*/
{
id: 'general-attr-event',
name: '通用属性和事件',
open: false,
pages: [
{
name: '通用属性',
......@@ -261,24 +250,6 @@ export default {
}
},
methods: {
triggerCollapse(index ?: number, item : ListItem) {
if (item.pages.length == 0) {
const page : Page = {
name: item.name,
enable: item.enable,
url: item.url,
}
this.goDetailPage(page)
return
}
for (var i = 0; i < this.list.length; ++i) {
if (index == i) {
this.list[i].open = !this.list[i].open
} else {
this.list[i].open = false
}
}
},
goDetailPage(e : Page) {
if (e.enable == false) {
uni.showToast({
......
......@@ -174,7 +174,7 @@ export default {
}
},
methods: {
triggerCollapse(index?: number, item: ListItem) {
triggerCollapse(index: number, item: ListItem) {
if (item.pages.length == 0) {
const page: Page = {
name: item.name,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册