提交 84c979e8 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

iOS端添加 Alert、toast 示例

上级 f4c96be4
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
}, },
{ {
"path" : "pages/SDKIntegration/XToast/XToast", "path" : "pages/SDKIntegration/Toast/Toast",
"style" : "style" :
{ {
"navigationBarTitleText": "", "navigationBarTitleText": "",
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<page-head :title="title"></page-head> <page-head :title="title"></page-head>
<uni-list> <uni-list>
<uni-list-item @tap="gotoTencentLocation" title="腾讯定位sdk集成示例" class="itemButton" :clickable="true" link/> <uni-list-item @tap="gotoTencentLocation" title="腾讯定位sdk集成示例" class="itemButton" :clickable="true" link/>
<!-- <uni-list-item @tap="gotoTencentMap" title="腾讯地图sdk集成示例" class="itemButton" :clickable="true" link/> --> <uni-list-item @tap="gotoTencentMap" title="腾讯地图sdk集成示例" class="itemButton" :clickable="true" link/>
<uni-list-item @tap="gotoXToast" title="XToast集成示例" class="itemButton" :clickable="true" link/> <uni-list-item @tap="gotoToast" title="Toast示例" class="itemButton" :clickable="true" link/>
</uni-list> </uni-list>
</view> </view>
</template> </template>
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
}, },
methods: { methods: {
gotoXToast:function(e){ gotoToast:function(e){
uni.navigateTo({ uni.navigateTo({
url:'/pages/SDKIntegration/XToast/XToast' url:'/pages/SDKIntegration/Toast/Toast'
}) })
}, },
gotoTencentLocation:function(e){ gotoTencentLocation:function(e){
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</view> </view>
<view class="uni-padding-wrap uni-common-mt"> <view class="uni-padding-wrap uni-common-mt">
<button @tap="testToastShow">调用XToast弹窗</button> <button @tap="testToastShow">调用 Toast 弹窗</button>
</view> </view>
</view> </view>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
data() { data() {
return { return {
title:"XToast集成示例" title:"Toast 示例"
} }
}, },
methods:{ methods:{
......
import { UIAlertController , UIAlertAction , UITextField } from "UIKit" import { UIAlertController , UIAlertAction , UITextField } from "UIKit"
import { uniViewController } from "DCUTSPlugin" import { DCUTS } from "DCUTSFoundation"
import { DispatchQueue } from 'Dispatch'; import { DispatchQueue } from 'Dispatch';
export function showAlert(title: string|null, message: string|null, result: (index: Number) => void) { export function showAlert(title: string|null, message: string|null, result: (index: Number) => void) {
...@@ -26,7 +26,7 @@ export function showAlert(title: string|null, message: string|null, result: (ind ...@@ -26,7 +26,7 @@ export function showAlert(title: string|null, message: string|null, result: (ind
alert.addAction(cancelAction) alert.addAction(cancelAction)
// 从 uniViewController 打开 alert 弹窗 // 从 uniViewController 打开 alert 弹窗
uniViewController().present(alert, animated= true) DCUTS.getCurrentViewController().present(alert, animated= true)
}) })
} }
...@@ -58,6 +58,6 @@ export function showPrompt(title: string|null, message: string|null,placeholder: ...@@ -58,6 +58,6 @@ export function showPrompt(title: string|null, message: string|null,placeholder:
alert.addAction(okAction) alert.addAction(okAction)
// 从 uniViewController 打开 alert 弹窗 // 从 uniViewController 打开 alert 弹窗
uniViewController().present(alert, animated= true) DCUTS.getCurrentViewController().present(alert, animated= true)
}) })
} }
\ No newline at end of file
import { DCUTS } from "DCUTSFoundation"
import "ToastSwiftFramework"
import { DispatchQueue } from 'Dispatch';
export function showToast():boolean{
DispatchQueue.main.async(execute=():void => {
DCUTS.getCurrentViewController().view.makeToast("这是一条提示信息")
})
return true
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册