index.uts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * 引用 iOS 系统库,示例如下:
  3. * import { UIDevice } from "UIKit";
  4. * [可选实现,按需引入]
  5. */
  6. // import {OpenDialogPageOptions,openDialogPage} from "DCloudUTSExtAPI";
  7. /* 引入 interface.uts 文件中定义的变量 */
  8. import { TestOpenDialogPage, TestCloseDialogPage } from '../interface.uts';
  9. var curDialogPage : UniDialogPage | null = null
  10. export const testOpenDialogPage : TestOpenDialogPage = function (url:string) {
  11. // let utsJsonObj : DCloudUTSExtAPI.OpenDialogPageOptions = {
  12. // url:"zhangsan"
  13. // }
  14. console.log("testOpenDialogPage")
  15. // let option = new OpenDialogPageOptions({
  16. // url:url
  17. // })
  18. let option = new OpenDialogPageOptions()
  19. option.url = url
  20. console.log(url)
  21. option.animationType ="slide-in-left"
  22. // option.parentPage = getCurrentPages()[0]
  23. option.success = (arg : OpenDialogPageSuccess )=>{
  24. console.log("success")
  25. }
  26. option.complete = (arg : OpenDialogPageComplete )=>{
  27. console.log(arg)
  28. }
  29. option.fail = (arg : OpenDialogPageFail )=>{
  30. console.log("fail")
  31. }
  32. curDialogPage = uni.openDialogPage(option)
  33. }
  34. export const testCloseDialogPage : TestCloseDialogPage = function () {
  35. console.log("testCloseDialogPage")
  36. if ( curDialogPage != null ){
  37. let option = new CloseDialogPageOptions()
  38. option.dialogPage = curDialogPage
  39. option.success = (arg : CloseDialogPageSuccess )=>{
  40. console.log("success")
  41. }
  42. option.complete = (arg : CloseDialogPageComplete )=>{
  43. console.log(arg)
  44. }
  45. option.fail = (arg : CloseDialogPageFail )=>{
  46. console.log("fail")
  47. }
  48. uni.closeDialogPage(option)
  49. }
  50. }
  51. /**
  52. * 更多插件开发的信息详见:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
  53. */