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

增加console.log 测试示例

上级 8c301ac0
......@@ -152,6 +152,15 @@
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SyntaxCase/consoleTest",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
......
<template>
<button @click="logStr">打印字符串</button>
<button @click="logFloat">打印浮点数</button>
<button @click="logInt">打印整数</button>
<button @click="logObject">打印对象</button>
<button @click="logFunction">打印函数</button>
</template>
<script>
import {
logStrTest,
logIntTest,
logFloatTest,
logObjectTest,
logFunctionTest
} from '@/uni_modules/uts-advance'
export default {
data() {
return {}
},
methods: {
logStr() {
logStrTest()
},
logFloat() {
logFloatTest()
},
logInt() {
logIntTest()
},
logObject() {
logObjectTest()
},
logFunction() {
logFunctionTest()
},
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -26,6 +26,8 @@
</uni-list-item>
<uni-list-item @tap="testParams" title="参数传递示例" :clickable="true" link>
</uni-list-item>
<uni-list-item @tap="testConsole" title="日志打印示例" :clickable="true" link>
</uni-list-item>
</uni-list>
</uni-collapse-item>
<uni-collapse-item title="资源加载示例" :border="false">
......@@ -51,7 +53,7 @@
<uni-list-item @tap="testAssetLoad" title="播放asset音频(需自定义基座)" :clickable="true" link/>
<uni-list-item @tap="gotoDecorView" title="操作DecorView" :clickable="true" link />
<uni-list-item @tap="testMetaRead" title="读取meta配置" :clickable="true" />
<uni-list-item @tap="testQuitApp" title="退出当前应用" :clickable="true" />
</uni-list>
</uni-collapse-item>
......@@ -72,7 +74,8 @@
doIntervalTask,
clearIntervalTask,
playAssetAudio,
getMetaConfig
getMetaConfig,
quitApp
} from "../../uni_modules/uts-advance";
......@@ -158,6 +161,9 @@
console.log(res);
});
},
testQuitApp(){
quitApp()
},
testMetaRead() {
let ret = getMetaConfig();
......@@ -187,6 +193,11 @@
url: '/pages/SyntaxCase/paramTest'
})
},
testConsole: function() {
uni.navigateTo({
url: '/pages/SyntaxCase/consoleTest'
})
},
testGetResourcePath: function() {
uni.navigateTo({
url: '/pages/advance/iOS/getResourcePath'
......
......@@ -415,4 +415,44 @@ export function callbackParam(callback : ParamCallback) {
array: ['4', '5', '6']
}
callback(ret)
}
\ No newline at end of file
}
/**
* 打印测试方法
*/
export function logStrTest() {
console.log("logStrTest 字符串打印测试")
}
export function logFloatTest() {
console.log(3.1415926)
}
export function logIntTest() {
console.log(2023)
}
export function logObjectTest(){
let ret : ParamOptions = {
title: "logObjectTest",
array: ['1', '2', '3']
}
console.log(ret)
}
export function logFunctionTest(){
let testFun = function(){
console.log("testFun")
}
console.log(testFun)
}
/**
*
*/
export function quitApp(){
UTSAndroid.quitApp()
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册