this.$log.push(this.text)

Former-commit-id: 68835d0d14a26c911493667952e8920533176cda [formerly 68835d0d14a26c911493667952e8920533176cda [formerly 68835d0d14a26c911493667952e8920533176cda [formerly 68835d0d14a26c911493667952e8920533176cda [formerly 36698e25123732c5ebcef3b1be4f6689a77fcc60 [formerly 0fdad5bcf43969f757bbcccb132a5876e84cba80]]]]]
Former-commit-id: 75abf1504b7ee705faefdbc909e48853a31804c5
Former-commit-id: 09a29410819b4a8a9206bf8f25983ced57acc210
Former-commit-id: c9ff463b6dccc21297940c5a029880b59c073bab [formerly 9b13330a75ac199ef4d634668f3daddc23faea93]
Former-commit-id: dc9f756459eb8a702f3a33729cbda50ec8a70085
Former-commit-id: 6085d6e77abf5efe9976a8414abec6524e621ac0
Former-commit-id: 2f1a97adf665f917721b92b3e8e8b7845d090e85
Former-commit-id: b739a8f5f768a0f5a864944b433f9ac6be47fe12
Former-commit-id: 139d6f73cc2c44d700276143280c56b7f34fef86
This commit is contained in:
liyang
2019-03-20 16:57:14 +08:00
parent 97c4e0864a
commit f0d9674ed2
3 changed files with 15 additions and 9 deletions

View File

@@ -7,7 +7,18 @@ export default {
Vue.prototype.$log = {
...util.log,
push (data) {
store.dispatch('d2admin/log/add', data)
if (typeof data === 'string') {
// 如果传递来的数据是字符串
// 赋值给 message 字段
// 为了方便使用
// eg: this.$log.push('foo text')
store.dispatch('d2admin/log/add', {
message: data
})
} else if (typeof data === 'object') {
// 如果传递来的数据是对象
store.dispatch('d2admin/log/add', data)
}
}
}
}

View File

@@ -16,14 +16,12 @@ export default {
data () {
return {
filename: __filename,
text: 'D2Admin log info'
text: 'some text'
}
},
methods: {
handleAdd () {
this.$log.push({
message: this.text
})
this.$log.push(this.text)
}
}
}

View File

@@ -7,7 +7,7 @@
:loading="uploading"
@click="handleUpload">
<d2-icon name="cloud-upload"/>
Upload
Upload {{list.length}} log data
</el-button>
</template>
<section class="page">
@@ -16,9 +16,6 @@
<span class="log-message">{{log.message}}</span>
</p>
</section>
<template slot="footer">
<span>{{list.length}}条记录</span>
</template>
</d2-container>
</template>