fix: 完善单测demo
This commit is contained in:
19
src/Test.vue
19
src/Test.vue
@@ -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
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user