Skip to content

Commit 5e6e6a5

Browse files
authored
fix: optimize bind-i18n styles (#925)
优化属性面板绑定国际化UI
1 parent 0a308db commit 5e6e6a5

File tree

2 files changed

+51
-43
lines changed

2 files changed

+51
-43
lines changed

packages/common/component/BindI18n.vue

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,29 @@
44
<tiny-select
55
ref="selectRef"
66
v-model="selectValue"
7-
placeholder="请根据显示值搜索"
7+
placeholder="请选择多语言文案"
88
filterable
9+
is-drop-inherit-width
910
:filter-method="filterMethod"
1011
@change="selectI18n"
1112
>
12-
<tiny-option v-for="item in langData" :key="item.key" :label="item[currentLang]" :value="item.key">
13-
<div style="display: flex">
14-
<span style="flex: 1">{{ item.key }}</span>
15-
<span style="flex: 1">{{ item[currentLang] }}</span>
16-
</div>
13+
<tiny-option v-for="item in langData" :key="item.key" :label="item.key + item[currentLang]" :value="item.key">
1714
</tiny-option>
1815
</tiny-select>
1916
<div v-if="paramsForm.length" class="params-form">
20-
<label>国际化参数配置</label>
17+
<div class="label">国际化参数配置</div>
2118
<div v-for="param in paramsForm" :key="param.name" class="params-item">
2219
<label>{{ param.name }}</label>
2320
<tiny-input v-model="param.value" @update:modelValue="paramsChange"></tiny-input>
2421
</div>
2522
</div>
2623
<slot name="suffix">
27-
<tiny-button type="info" @click="openCreateForm">
28-
<icon-plus class="icon-plus"></icon-plus>
29-
<span>创建新的多语言文案</span>
30-
</tiny-button>
31-
<tiny-button v-if="isBind" type="info" @click="unbindI18n"> 解除关联 </tiny-button>
24+
<div class="bottom-buttons">
25+
<tiny-button v-if="isBind" @click="unbindI18n">解除关联</tiny-button>
26+
<tiny-button type="primary" @click="openCreateForm">
27+
<span>创建新的多语言文案</span>
28+
</tiny-button>
29+
</div>
3230
</slot>
3331
</div>
3432
<div v-show="showEditItem" class="addNewLanguage">
@@ -43,9 +41,9 @@
4341
<input v-model="editForm[locale.lang]" class="tiny-input__inner" />
4442
</div>
4543
</div>
46-
<div class="add-btns">
47-
<tiny-button type="info" @click="activeI18n">国际化管理 </tiny-button>
48-
<tiny-button type="info" @click="addBindI18n">添加并关联 </tiny-button>
44+
<div class="bottom-buttons">
45+
<tiny-button @click="activeI18n">国际化管理</tiny-button>
46+
<tiny-button type="primary" @click="addBindI18n">添加并关联</tiny-button>
4947
</div>
5048
</div>
5149
</div>
@@ -57,15 +55,13 @@ import { useLayout, useTranslate } from '@opentiny/tiny-engine-meta-register'
5755
import { PROP_DATA_TYPE } from '../js/constants'
5856
import { utils } from '@opentiny/tiny-engine-utils'
5957
import { Select, Option, Button, Input } from '@opentiny/vue'
60-
import { iconPlus } from '@opentiny/vue-icon'
6158
6259
export default {
6360
components: {
6461
TinySelect: Select,
6562
TinyOption: Option,
6663
TinyButton: Button,
67-
TinyInput: Input,
68-
IconPlus: iconPlus()
64+
TinyInput: Input
6965
},
7066
inheritAttrs: false,
7167
props: {
@@ -169,10 +165,7 @@ export default {
169165
170166
<style lang="less" scoped>
171167
.languageContent {
172-
text-align: center;
173168
z-index: 99;
174-
margin-top: 5px;
175-
margin-bottom: 16px;
176169
177170
.tiny-svg {
178171
margin-right: 10px;
@@ -182,17 +175,6 @@ export default {
182175
color: #ccc;
183176
}
184177
}
185-
.tiny-button {
186-
max-width: initial;
187-
padding: 0 12px;
188-
background-color: var(--ti-lowcode-tabs-border-color);
189-
border-color: var(--ti-lowcode-tootip-input-border-color);
190-
color: var(--ti-lowcode-toolbar-icon-color);
191-
&:hover {
192-
background-color: var(--ti-lowcode-canvas-wrap-bg);
193-
border-color: var(--ti-lowcode-tabs-border-color);
194-
}
195-
}
196178
.addNewLanguage {
197179
.tiny-input {
198180
display: flex;
@@ -209,23 +191,33 @@ export default {
209191
.tiny-input__inner {
210192
flex: 1;
211193
}
212-
.add-btns {
213-
text-align: right;
214-
padding: 0 8px;
215-
}
216194
}
217195
}
218196
.params-form {
219-
& > label {
220-
line-height: 30px;
197+
.label {
198+
margin: 16px 0;
199+
font-size: 12px;
200+
line-height: 18px;
201+
}
202+
.params-item + .params-item {
203+
margin-top: 12px;
221204
}
222205
.params-item {
223206
display: flex;
224207
align-items: center;
225208
label {
226209
width: 80px;
227210
}
228-
margin-bottom: 10px;
211+
}
212+
}
213+
.bottom-buttons {
214+
display: flex;
215+
justify-content: flex-end;
216+
margin-top: 16px;
217+
gap: 8px;
218+
.tiny-button,
219+
.tiny-button.tiny-button--default {
220+
margin: 0;
229221
}
230222
}
231223
</style>

packages/common/component/I18nInput.vue

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
<template #suffix>
55
<tiny-popover
66
ref="popoverRef"
7-
width="260"
7+
width="340"
88
trigger="click"
99
:visible-arrow="false"
10-
popper-class="lowcode"
10+
popper-class="i18n-input-popover"
1111
@hide="onHide"
1212
>
1313
<div class="popover-content">
14+
<h3 class="title">绑定国际化</h3>
1415
<icon-close class="icon-close" @click="closePopover"></icon-close>
1516
<bind-i18n
1617
ref="addI1i8nRef"
@@ -124,9 +125,24 @@ export default {
124125
}
125126
}
126127
.popover-content {
127-
text-align: right;
128+
position: relative;
129+
130+
.title {
131+
margin-top: 0;
132+
margin-bottom: 16px;
133+
font-size: 14px;
134+
line-height: 20px;
135+
}
128136
.icon-close {
129-
margin-right: 5px;
137+
position: absolute;
138+
top: 0;
139+
right: 0;
130140
}
131141
}
132142
</style>
143+
144+
<style>
145+
.tiny-popover.tiny-popover.tiny-popper[x-placement].i18n-input-popover {
146+
padding: 20px;
147+
}
148+
</style>

0 commit comments

Comments
 (0)