2019-12-18 17:22:59 +08:00
|
|
|
# Debug
|
2019-12-15 19:14:56 +08:00
|
|
|
```html
|
2019-12-17 18:14:02 +08:00
|
|
|
<n-card title="Random String Logs" :segmented="{
|
|
|
|
header: 'soft',
|
|
|
|
content: 'hard'
|
|
|
|
}">
|
|
|
|
<n-log
|
|
|
|
style="margin-top: -12px; margin-bottom: -12px;"
|
|
|
|
:log="log"
|
2019-12-18 17:22:59 +08:00
|
|
|
@require-more="handleRequireMore"
|
2019-12-17 22:17:26 +08:00
|
|
|
:loading="loading"
|
2019-12-17 18:14:02 +08:00
|
|
|
trim
|
|
|
|
/>
|
|
|
|
<template v-slot:action>
|
|
|
|
<n-button @click="clear">Clear</n-button>
|
|
|
|
</template>
|
|
|
|
</n-card>
|
2019-12-15 19:14:56 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
```js
|
2019-12-17 18:14:02 +08:00
|
|
|
function log () {
|
|
|
|
const l = []
|
|
|
|
for (let i = 0; i < 40; ++i) {
|
|
|
|
l.push((Math.random()).toString(16))
|
2019-12-15 19:14:56 +08:00
|
|
|
}
|
2019-12-17 18:14:02 +08:00
|
|
|
return l.join('\n') + '\n'
|
2019-12-15 19:14:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
2019-12-17 22:17:26 +08:00
|
|
|
loading: false,
|
2019-12-17 18:14:02 +08:00
|
|
|
log: log()
|
2019-12-15 19:14:56 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2019-12-17 18:14:02 +08:00
|
|
|
clear () {
|
|
|
|
this.log = ''
|
|
|
|
},
|
2019-12-18 17:22:59 +08:00
|
|
|
handleRequireMore (from) {
|
2019-12-17 22:17:26 +08:00
|
|
|
if (this.loading) return
|
|
|
|
this.loading = true
|
2019-12-15 19:14:56 +08:00
|
|
|
setTimeout(() => {
|
2019-12-18 17:22:59 +08:00
|
|
|
if (from === 'top') {
|
|
|
|
this.log = log() + this.log
|
|
|
|
} else if (from === 'bottom') {
|
|
|
|
this.log = this.log + log()
|
|
|
|
}
|
2019-12-17 22:17:26 +08:00
|
|
|
this.loading = false
|
2019-12-17 18:14:02 +08:00
|
|
|
}, 1000)
|
2019-12-15 19:14:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|