From a77ae9e81db7c751e200e23fb51cf938e3c7434b Mon Sep 17 00:00:00 2001 From: duqingquan Date: Wed, 28 Jun 2023 17:45:37 +0800 Subject: [PATCH] =?UTF-8?q?action=20sheet=20=E9=A2=9C=E8=89=B2=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/action-sheet/action-sheet.uvue | 69 ++++++++++++++++-------- pages/API/get-location/get-location.uvue | 3 +- 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/pages/API/action-sheet/action-sheet.uvue b/pages/API/action-sheet/action-sheet.uvue index 6062b99f..74b48355 100644 --- a/pages/API/action-sheet/action-sheet.uvue +++ b/pages/API/action-sheet/action-sheet.uvue @@ -13,7 +13,7 @@ 自定义itemColor - + @@ -70,27 +70,54 @@ } } }, + itemColorChange: function (e : SwitchChangeEvent) { + this.itemColorCustom = e.detail.value + }, actionSheetTap() { - console.log("itemColorCustom === " + this.itemColorCustom) - const that = this - uni.showActionSheet({ - title: this.items[this.current].value, - itemList: ['item1', 'item2', 'item3', 'item4'], - // #ifdef H5 - popover: { - // 104: navbar + topwindow 高度,暂时 fix createSelectorQuery 在 pc 上获取 top 不准确的 bug - top: that.buttonRect.top + 104 + that.buttonRect.height, - left: that.buttonRect.left + that.buttonRect.width / 2 - }, - // #endif - success: (e) => { - console.log(e.tapIndex); - uni.showToast({ - title: "点击了第" + e.tapIndex + "个选项", - icon: "none" - }) - } - }) + + const that = this + if(this.itemColorCustom){ + uni.showActionSheet({ + title: this.items[this.current].value, + itemList: ['item1', 'item2', 'item3', 'item4'], + itemColor:"#ff00ff", + // #ifdef H5 + popover: { + // 104: navbar + topwindow 高度,暂时 fix createSelectorQuery 在 pc 上获取 top 不准确的 bug + top: that.buttonRect.top + 104 + that.buttonRect.height, + left: that.buttonRect.left + that.buttonRect.width / 2 + }, + // #endif + success: (e) => { + console.log(e.tapIndex); + uni.showToast({ + title: "点击了第" + e.tapIndex + "个选项", + icon: "none" + }) + } + }) + }else{ + uni.showActionSheet({ + title: this.items[this.current].value, + itemList: ['item1', 'item2', 'item3', 'item4'], + // #ifdef H5 + popover: { + // 104: navbar + topwindow 高度,暂时 fix createSelectorQuery 在 pc 上获取 top 不准确的 bug + top: that.buttonRect.top + 104 + that.buttonRect.height, + left: that.buttonRect.left + that.buttonRect.width / 2 + }, + // #endif + success: (e) => { + console.log(e.tapIndex); + uni.showToast({ + title: "点击了第" + e.tapIndex + "个选项", + icon: "none" + }) + } + }) + } + + }, // #ifdef H5 diff --git a/pages/API/get-location/get-location.uvue b/pages/API/get-location/get-location.uvue index be9784b2..3cce29e7 100644 --- a/pages/API/get-location/get-location.uvue +++ b/pages/API/get-location/get-location.uvue @@ -60,7 +60,7 @@ this.altitudeSelect = e.detail.value }, geocodeChange: function (e : SwitchChangeEvent) { - this.geocodeChange = e.detail.value + this.geocodeSelect = e.detail.value }, highAccuracySelectChange: function (e : SwitchChangeEvent) { this.isHighAccuracySelect = e.detail.value @@ -82,6 +82,7 @@ type: this.items[this.current].value, altitude:this.altitudeSelect, isHighAccuracy:this.isHighAccuracySelect, + geocode:this.geocodeSelect, success: function (res:any) { uni.hideLoading() console.log(res); -- GitLab