fix: 修改公共脚本不同语言分号问题&评论组件展开折叠问题
This commit is contained in:
parent
e8295cd86b
commit
6805e8cf06
|
@ -143,13 +143,6 @@ export default defineComponent({
|
|||
);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.commentList,
|
||||
() => {
|
||||
expendedIds.value = [];
|
||||
}
|
||||
);
|
||||
|
||||
const renderChildrenList = (list?: CommentItem[]) => {
|
||||
if (!list || list.length === 0) {
|
||||
return null;
|
||||
|
@ -176,6 +169,7 @@ export default defineComponent({
|
|||
const renderParentList = (list: CommentItem[]) => {
|
||||
return list.map((item) => (
|
||||
<>
|
||||
{/* {expendedIds.value}--expendedIds */}
|
||||
<Item
|
||||
mode={'parent'}
|
||||
onReply={() => handleReply(item)}
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
result: '',
|
||||
};
|
||||
|
||||
const form = ref({ ...initForm });
|
||||
const form = ref({ ...cloneDeep(initForm) });
|
||||
|
||||
const columns: MsTableColumn = [
|
||||
{
|
||||
|
@ -243,7 +243,7 @@
|
|||
() => showScriptDrawer.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
form.value = { ...initForm };
|
||||
form.value = { ...cloneDeep(initForm) };
|
||||
innerParams.value = [];
|
||||
editScriptId.value = props.scriptId;
|
||||
if (editScriptId.value) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="p-[12px] pt-0">
|
||||
<div v-for="item of SCRIPT_MENU" :key="item.value" class="menuItem px-1" @click="handleClick(item)">
|
||||
<div v-for="item of scriptMenus" :key="item.value" class="menuItem px-1" @click="handleClick(item)">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -50,7 +50,7 @@
|
|||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
||||
import type { CommonScriptMenu } from './types';
|
||||
import { getCodeTemplate, SCRIPT_MENU } from './utils';
|
||||
import { getCodeTemplate, getScriptMenu } from './utils';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -81,6 +81,10 @@
|
|||
{ text: 'JavaScript', value: LanguageEnum.JAVASCRIPT },
|
||||
];
|
||||
|
||||
const scriptMenus = computed(() => {
|
||||
return innerLanguageType.value !== LanguageEnum.PYTHON ? getScriptMenu(';') : getScriptMenu('');
|
||||
});
|
||||
|
||||
function expandedHandler() {
|
||||
innerExpand.value = !innerExpand.value;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ function getInsertCommonScript() {
|
|||
return [];
|
||||
}
|
||||
|
||||
export const SCRIPT_MENU: CommonScriptMenu[] = [
|
||||
export function getScriptMenu(SemicolonStr: string) {
|
||||
return [
|
||||
// TODO 这个版本不上
|
||||
// {
|
||||
// title: t('project.code_segment.importApiTest'),
|
||||
|
@ -35,23 +36,23 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
|
|||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetVariable'),
|
||||
value: 'vars.get("variable_name");',
|
||||
value: `vars.get("variable_name")${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateSetVariable'),
|
||||
value: 'vars.put("variable_name", "variable_value");',
|
||||
value: `vars.put("variable_name", "variable_value")${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseHeader'),
|
||||
value: 'prev.getResponseHeaders();',
|
||||
value: `prev.getResponseHeaders()${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseCode'),
|
||||
value: 'prev.getResponseCode();',
|
||||
value: `prev.getResponseCode()${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseResult'),
|
||||
value: 'prev.getResponseDataAsString();',
|
||||
value: `prev.getResponseDataAsString()${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.paramEnvironmentSetGlobalVariable'),
|
||||
|
@ -64,6 +65,7 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
|
|||
command: 'api_stop',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// 处理groovyCode 请求头
|
||||
function getGroovyHeaders(requestHeaders: Record<string, any>) {
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
value: 'LIST',
|
||||
},
|
||||
],
|
||||
width: 150,
|
||||
titleSlotName: 'typeTitle',
|
||||
typeTitleTooltip: t('apiScenario.params.typeTooltip'),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue