instanceTest.vue 755 字节
Newer Older
杜庆泉's avatar
杜庆泉 已提交
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
<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);
				const user2 = new User("李四", 30);  
				const user3 = new User("王五", 40);  
杜庆泉's avatar
杜庆泉 已提交
27 28 29
				
				let userText1 = user1.describeSelf() 
				let userText2 = user2.describeSelf()   
杜庆泉's avatar
杜庆泉 已提交
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
				let userText3 = user3.describeSelf()  

				
				if(userText1 == userText2 || userText1 == userText3 || userText2 == userText3){
					this.ret = '测试未通过'
				}else{
					this.ret = '测试通过'
				}
				
			}

			
		}
	}
</script>

<style>
</style>