自动调整高度

This commit is contained in:
fofolee 2022-04-28 17:32:37 +08:00
parent 715b4bc296
commit 1e260e23f0
3 changed files with 13 additions and 24 deletions

View File

@ -23,7 +23,6 @@
<ResultArea
v-if="isResultShow"
@frameLoad="frameLoad"
@expandTrees="outputAutoHeight(fromUtools)"
:frameInitHeight="frameInitHeight"
:enableHtml="enableHtml"
:runResultStatus="runResultStatus"
@ -39,7 +38,6 @@
<ResultArea
v-if="isResultShow"
@frameLoad="frameLoad"
@expandTrees="outputAutoHeight(fromUtools)"
:frameInitHeight="frameInitHeight"
:enableHtml="enableHtml"
:runResultStatus="runResultStatus"
@ -48,6 +46,7 @@
:key="timeStamp"
/>
</div>
<q-resize-observer @resize="outputAutoHeight" debounce="0" />
</div>
</template>
@ -238,22 +237,18 @@ export default {
this.runResultStatus = isSuccess;
if (!_.isArray(content)) content = [content];
this.runResult = this.runResult.concat(content);
this.outputAutoHeight(this.fromUtools);
},
// utools
outputAutoHeight(autoHeight = true, autoScroll = true) {
this.$nextTick(() => {
let clientHeight = document.body.clientHeight;
let pluginHeight =
clientHeight < this.maxHeight ? clientHeight : this.maxHeight;
autoHeight && utools.setExpendHeight(pluginHeight);
autoScroll &&
window.scroll({
top: clientHeight,
left: 0,
behavior: "smooth",
});
});
outputAutoHeight(e) {
let autoScroll = 1;
let pluginHeight = e.height < this.maxHeight ? e.height : this.maxHeight;
this.fromUtools && utools.setExpendHeight(pluginHeight);
autoScroll &&
window.scroll({
top: e.height,
left: 0,
behavior: "smooth",
});
},
stopRun() {
this.runResult = [];
@ -272,7 +267,6 @@ export default {
quickcommand.closeWaitButton();
},
frameLoad(initHeight) {
this.outputAutoHeight(this.fromUtools);
this.frameInitHeight = initHeight;
},
},

View File

@ -16,12 +16,8 @@
class="text q-pa-md"
>
<div v-for="item in runResult" :key="item">
<ObjectTree
:obj="item"
v-if="typeof item === 'object'"
@expandTrees="$emit('expandTrees')"
/>
<pre class="result" v-text="item" v-else></pre>
<ObjectTree :obj="item" v-if="typeof item === 'object'" />
<pre class="result" v-text="item" v-else-if="!!item"></pre>
</div>
</div>
</div>

View File

@ -120,7 +120,6 @@ export default {
}
}
done(children);
this.$emit("expandTrees");
},
hasChildren(item) {
if (typeof item === "object")