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

新增实例创建测试示例

上级 92a1a39c
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path" : "pages/index/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/advance",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SystemAPI/SystemAPI",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SystemAPI/Alert/alert",
"style" :
{
"navigationBarTitleText": ""
}
},
{
"path" : "pages/component/helloView",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/SDKIntegration",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/TencentLocation/TencentLocation",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/Lottie/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/Toast/Toast",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/lifecycle/lifecycle",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/resource/resource",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/android/decorview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/iOS/getResourcePath",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/android/assetaudio",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SystemAPI/ScreenListen/screenlisten",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SyntaxCase/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SyntaxCase/paramTest",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SyntaxCase/consoleTest",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/test/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/advance",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SystemAPI/SystemAPI",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SystemAPI/Alert/alert",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/component/helloView",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/SDKIntegration",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/TencentLocation/TencentLocation",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/Lottie/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/Toast/Toast",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/lifecycle/lifecycle",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/resource/resource",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/android/decorview",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/iOS/getResourcePath",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/android/assetaudio",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SystemAPI/ScreenListen/screenlisten",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/paramTest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/consoleTest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/instanceTest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/test/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#007AFF",
......@@ -186,7 +176,7 @@
"pagePath": "pages/advance/advance",
"text": "进阶"
}, {
"pagePath":"pages/SystemAPI/SystemAPI",
"pagePath": "pages/SystemAPI/SystemAPI",
"text": "系统API"
}, {
"pagePath": "pages/SDKIntegration/SDKIntegration",
......@@ -201,4 +191,4 @@
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
}
}
\ No newline at end of file
<template>
{{ret}}
<button @click="instanceCreate">多实例创建测试</button>
</template>
<script>
import {
User
} from '@/uni_modules/uts-advance'
export default {
data() {
return {
ret:''
}
},
methods: {
instanceCreate() {
const user1 = new User("张三", 20);
let userText1 = user1.describeSelf()
const user2 = new User("李四", 30);
let userText2 = user2.describeSelf()
const user3 = new User("王五", 40);
let userText3 = user3.describeSelf()
if(userText1 == userText2 || userText1 == userText3 || userText2 == userText3){
this.ret = '测试未通过'
}else{
this.ret = '测试通过'
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -28,6 +28,8 @@
</uni-list-item>
<uni-list-item @tap="testConsole" title="日志打印示例" :clickable="true" link>
</uni-list-item>
<uni-list-item @tap="testInstance" title="实例测试示例" :clickable="true" link>
</uni-list-item>
<uni-list-item @tap="testGrammar" title="基础语法测试例" :clickable="true" link>
</uni-list-item>
</uni-list>
......@@ -205,6 +207,11 @@
url: '/pages/test/index'
})
},
testInstance: function() {
uni.navigateTo({
url: '/pages/SyntaxCase/instanceTest'
})
},
testGetResourcePath: function() {
uni.navigateTo({
url: '/pages/advance/iOS/getResourcePath'
......
......@@ -454,5 +454,21 @@ export function quitApp(){
UTSAndroid.quitApp()
}
export class User {
private name : string;
private age : Int;
constructor(hostP : string, port : Int) {
this.name = hostP;
this.age = port;
}
describeSelf():string{
let text = "name = " + this.name + ";age = " + this.age
return text
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册