Skip to content

Commit

Permalink
fix(network): Fix disableLogScrolling not working in Network panel.…
Browse files Browse the repository at this point in the history
… (issue #282, #379)
  • Loading branch information
Maizify committed Apr 28, 2021
1 parent 2817f73 commit 2a4fd4d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
English | [简体中文](./CHANGELOG_CN.md)


#### 3.5.0 (2021-MM-DD)
#### 3.5.0 (2021-04-28)

- `Feature(Log)` Add button to copy logs. (by @akai)
- `Feature(Plugin)` New third-party plugin [vconsole-vue-devtools-plugin](https://github.com/Zippowxk/vue-vconsole-devtools). (by @Zippowxk)
- `Fix(Log)` Do not sort array's keys. (issue #372)
- `Fix(Network)` Fix error when `contentType` is `text/html`. (by @zimv)
- `Fix(Network)` Fix `disableLogScrolling` not working in Network panel. (issue #282, #379)


#### V3.4.1 (2021-04-09)
Expand Down
5 changes: 5 additions & 0 deletions dev/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
}
});

// setInterval(() => {
// console.log(Math.random());
// console.log('[system]', Math.random());
// }, 300);

function formattedLog() {
console.info('formattedLog() Start');
console.log('[default]', 'This log should be shown in Log tab.');
Expand Down
12 changes: 11 additions & 1 deletion dev/network.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@
</html>

<script>
window.vConsole = new window.VConsole();
window.vConsole = new window.VConsole({
maxLogNumber: 1000,
// disableLogScrolling: true,
onReady: function() {
console.log('vConsole is ready.');
}
});

// setInterval(() => {
// postAjax();
// }, 300);

function postAjax() {
console.info('postAjax() Start, response should be logged after End');
Expand Down
2 changes: 1 addition & 1 deletion dist/vconsole.min.js

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions src/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class VConsoleNetworkTab extends VConsolePlugin {
onShow() {
this.isShow = true;
if (this.isInBottom == true) {
this.scrollToBottom();
this.autoScrollToBottom();
}
}

Expand All @@ -119,6 +119,12 @@ class VConsoleNetworkTab extends VConsolePlugin {

onShowConsole() {
if (this.isInBottom == true) {
this.autoScrollToBottom();
}
}

autoScrollToBottom() {
if (!this.vConsole.option.disableLogScrolling) {
this.scrollToBottom();
}
}
Expand Down Expand Up @@ -254,8 +260,8 @@ class VConsoleNetworkTab extends VConsolePlugin {
}

// scroll to bottom
if (this.isInBottom) {
this.scrollToBottom();
if (this.isInBottom && this.isShow) {
this.autoScrollToBottom();
}
}

Expand Down

0 comments on commit 2a4fd4d

Please sign in to comment.