自动调整高度

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

View File

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

View File

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