8000 fix: improve console.dir output · likeshan168/nativescript-vue@848440a · GitHub
[go: up one dir, main page]

Skip to content

Commit 848440a

Browse files
committed
fix: improve console.dir output
1 parent b9da638 commit 848440a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

platform/nativescript/framework.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import NavigatorPlugin from './plugins/navigator-plugin'
1414
import RouterPlugin from './plugins/router-plugin'
1515

1616
import { setVue } from './util'
17+
1718
setVue(Vue)
1819

1920
Vue.use(ModalPlugin)
@@ -26,7 +27,11 @@ console.log = (function(log, inspect, Vue) {
2627
return log.apply(
2728
this,
2829
Array.prototype.map.call(arguments, function(arg) {
29-
return inspect(arg, { depth: 1, colors: Vue.config.debug })
30+
return inspect(arg, {
31+
depth: 2,
32+
colors: Vue.config.debug,
33+
showHidden: true
34+
}).replace(/\\n/g, '\n')
3035
})
3136
)
3237
}

samples/app/app-with-http-requests.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const Vue = require('./nativescript-vue')
2+
Vue.config.debug = true
3+
const http = require('http')
4+
5+
new Vue({
6+
template: `
7+
<Page>
8+
<ScrollView>
9+
<StackLayout>
10+
<Button text="make request" @tap="makeRequest"/>
11+
</StackLayout>
12+
</ScrollView>
13+
</Page>
14+
`,
15+
16+
methods: {
17+
async makeRequest() {
18+
const res = await http.request({
19+
url: 'https://httpbin.org/anything',
20+
method: 'GET'
21+
})
22+
23+
console.dir(res)
24+
}
25+
}
26+
}).$start()

0 commit comments

Comments
 (0)
0