fix: 完善单测demo

This commit is contained in:
chenjinsong
2023-01-11 15:50:04 +08:00
parent d54054510b
commit 4fed5a9b8c
3 changed files with 50 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
<template>
<span test-id="count">{{count}}</span>
<span test-id="title">{{getData.title}}</span>
<span test-id="id">{{obj.id}}</span>
<span test-id="title">{{obj.title}}</span>
<button test-id="button" @click="click">click</button>
</template>
@@ -13,16 +14,24 @@ export default {
data () {
return {
count: 0,
getData: { id: 1, title: 'title' }
obj: { id: 1, title: 'title' }
}
},
methods: {
click () {
this.count++
},
async getPosts () {
axios.get('/api/posts').then(response => {
this.getData = response.data
async getObj () {
axios.get('/api/getObjId').then(response => {
this.obj.id = response.data
})
axios.get('/api/getObjTitle').then(response => {
this.obj.title = response.data
})
},
async getCount () {
axios.get('/api/getCount').then(response => {
this.count = response.data
})
}
},