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

chore: remove warning

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