index.uts 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
/**
 * 引用 iOS 系统库,示例如下:
 * import { UIDevice } from "UIKit";
 * [可选实现,按需引入]
 */

// import {OpenDialogPageOptions,openDialogPage} from "DCloudUTSExtAPI";

/* 引入 interface.uts 文件中定义的变量 */
import { TestOpenDialogPage, TestCloseDialogPage } from '../interface.uts';

var curDialogPage : UniDialogPage | null = null
export const testOpenDialogPage : TestOpenDialogPage = function (url:string) {

	// let utsJsonObj : DCloudUTSExtAPI.OpenDialogPageOptions = {
	// 	url:"zhangsan"
	// }
	 console.log("testOpenDialogPage")

	// let option = new OpenDialogPageOptions({
	// 	url:url
	// })
	let option = new OpenDialogPageOptions()
	option.url = url
  console.log(url)

	option.animationType ="slide-in-left"
	// option.parentPage = getCurrentPages()[0]

	option.success = (arg : OpenDialogPageSuccess )=>{
		console.log("success")
	}
	option.complete = (arg : OpenDialogPageComplete )=>{
		console.log(arg)
	}

	option.fail = (arg : OpenDialogPageFail )=>{
		console.log("fail")
	}
	curDialogPage = uni.openDialogPage(option)
}

export const testCloseDialogPage : TestCloseDialogPage = function () {
	console.log("testCloseDialogPage")
  if ( curDialogPage != null ){
	let option = new CloseDialogPageOptions()
	option.dialogPage = curDialogPage

	option.success = (arg : CloseDialogPageSuccess )=>{
		console.log("success")
	}
	option.complete = (arg : CloseDialogPageComplete )=>{
		console.log(arg)
	}

	option.fail = (arg : CloseDialogPageFail )=>{
		console.log("fail")
	}
  	uni.closeDialogPage(option)
  }
}

/**
 * 更多插件开发的信息详见:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
 */