-
Notifications
You must be signed in to change notification settings - Fork 2.8k
perf: Optimize some style issues #2764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
| <el-select | ||
| class="m-2" | ||
| multiple | ||
| collapse-tags | ||
| filterable | ||
| clearable | ||
| v-bind="$attrs" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| </h4> | ||
| </template> | ||
| <div class="hit-test__main p-16" v-loading="loading"> | ||
| <div class="question-title clearfix" v-if="questionTitle"> | ||
| <div class="question-title" :style="{ visibility: questionTitle ? 'visible' : 'hidden' }"> | ||
| <div class="avatar"> | ||
| <AppAvatar> | ||
| <img src="@/assets/user-icon.svg" style="width: 54%" alt="" /> | ||
|
|
@@ -233,6 +233,7 @@ const { | |
| params: { id } | ||
| } = route as any | ||
|
|
||
| const quickInputRef = ref() | ||
| const ParagraphDialogRef = ref() | ||
| const loading = ref(false) | ||
| const paragraphDetail = ref<any[]>([]) | ||
|
|
@@ -297,7 +298,9 @@ function sendChatHandle(event: any) { | |
| } | ||
| } | ||
| const insertNewlineAtCursor = (event?: any) => { | ||
| const textarea = document.querySelector('.el-textarea__inner') as HTMLTextAreaElement | ||
| const textarea = quickInputRef.value.$el.querySelector( | ||
| '.el-textarea__inner' | ||
| ) as HTMLTextAreaElement | ||
| const startPos = textarea.selectionStart | ||
| const endPos = textarea.selectionEnd | ||
| // 阻止默认行为(避免额外的换行符) | ||
|
|
@@ -354,6 +357,8 @@ onMounted(() => {}) | |
| padding-left: 40px; | ||
| .text { | ||
| padding: 6px 0; | ||
| height: 34px; | ||
| box-sizing: border-box; | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -402,7 +407,7 @@ onMounted(() => {}) | |
| } | ||
|
|
||
| .hit-test-height { | ||
| height: calc(var(--app-main-height) - 135px); | ||
| height: calc(var(--app-main-height) - 170px); | ||
| } | ||
| .document-card { | ||
| height: 210px; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No major issues were found in the provided code. However, here are a few minor optimizations you might consider:
const quickInputRef = ref<HTMLTextAreaElement | null>(null); // Add type annotation
Here's the modified code snippet with these improvements: const quickInputRef = ref<HTMLTextAreaElement | null>(null);
// Other parts remain unchanged...These suggestions aim to make the code more maintainable and efficient while adhering to best practices of programming. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| <template> | ||
| <div class="flex-between mb-16"> | ||
| <h5 class="lighter">{{ inputFieldConfig.title }}</h5> | ||
| <h5 class="break-all ellipsis lighter" style="max-width:80%" :title="inputFieldConfig.title"> | ||
| {{ inputFieldConfig.title }} | ||
| </h5> | ||
| <div> | ||
| <el-button type="primary" link @click="openChangeTitleDialog"> | ||
| <el-icon> | ||
|
|
@@ -172,7 +174,7 @@ function refreshFieldTitle(data: any) { | |
| } | ||
|
|
||
| const getDefaultValue = (row: any) => { | ||
| if(row.input_type === 'PasswordInput') { | ||
| if (row.input_type === 'PasswordInput') { | ||
| return '******' | ||
| } | ||
| if (row.default_value) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few things that could be improved in your code:
Here's revised version with these improvements: <template>
<div class="flex-between mb-16">
<h5 class="break-all ellipsis lighter" style="max-width:80%">
{{ inputFieldConfig.title }}
</h5>
<div>
<el-button type="primary" link @click="openChangeTitleDialog">
<el-icon>
<!-- Your icon here -->
</el-icon>
</el-button>
</div>
</div>
</template>
<script>
export default {
// ... rest of the script ...
}
</script>
<style scoped>
/* Add your styles here */
</style>And the corresponding JavaScript part (assuming it's a Vue component): // Assuming this is the refreshFieldTitle method from your original snippet
const refreshFieldTitle = (row) => {
if (row.input_type === 'PasswordInput') {
return '******';
}
if (row.default_value) {
// Return whatever logic applies to defaultValue based on row.data
}
};Make sure to adjust the styling according to your design standards. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an optimized version of the code:
Key changes:
w-[232px]andmin-h-[172px]) for Avatar component and fixed image size.These modifications reduce redundancy, making the code more readable and easier to manage while maintaining functionality unchanged.