提交 98ed0cf8 编写于 作者: 杜庆泉's avatar 杜庆泉

增加 java 混编调用console.log示例

上级 b4b0d855
package uts.sdk.modules.utsSyntaxcase; package uts.sdk.modules.utsSyntaxcase;
import io.dcloud.uts.console;
public class JavaUser { public class JavaUser {
public String name; public String name;
...@@ -11,7 +13,9 @@ public class JavaUser { ...@@ -11,7 +13,9 @@ public class JavaUser {
} }
public String toString() { public String toString() {
return "Name: " + name + ", Age: " + age; String ret = "Name: " + name + ", Age: " + age;
console.log(ret);
return ret;
} }
......
...@@ -267,9 +267,11 @@ export function callKotlinMethodGetInfo():String { ...@@ -267,9 +267,11 @@ export function callKotlinMethodGetInfo():String {
} }
export function callJavaMethodGetInfo():String { export function callJavaMethodGetInfo():String {
return new JavaUser("jack",12).name return new JavaUser("jack",12).toString()
} }
export function callKotlinCallbackUTS(callback: (res: string) => void) { export function callKotlinCallbackUTS(callback: (res: string) => void) {
NativeCode.kotlinCallbackUTS(function(res:string){ NativeCode.kotlinCallbackUTS(function(res:string){
console.log(res) console.log(res)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册