-
Notifications
You must be signed in to change notification settings - Fork 271
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
docs(input): [input] optimizing input component example #2476
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 |
---|---|---|
|
@@ -21,7 +21,6 @@ | |
<br /> | ||
<div> | ||
<span>autocomplete="on"</span> | ||
<br /><br /> | ||
<form> | ||
<tiny-input v-model="inputAutocomplete" autocomplete="on" name="email" type="email"></tiny-input> | ||
</form> | ||
|
@@ -48,11 +47,16 @@ export default { | |
</script> | ||
|
||
<style scoped> | ||
.demo-input > p > span { | ||
.demo-input > p > span, | ||
.demo-input > div > span { | ||
display: inline-block; | ||
width: 130px; | ||
} | ||
.demo-input .tiny-input { | ||
width: 250px; | ||
} | ||
.demo-input > div { | ||
display: flex; | ||
align-items: center; | ||
} | ||
Comment on lines
+50
to
+61
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. 🛠️ Refactor suggestion Improve CSS maintainability and consistency. The current CSS structure mixes different layout approaches and uses magic numbers:
Consider this more maintainable approach: - .demo-input > p > span,
- .demo-input > div > span {
- display: inline-block;
- width: 130px;
- }
- .demo-input .tiny-input {
- width: 250px;
- }
- .demo-input > div {
- display: flex;
- align-items: center;
- }
+ .demo-input {
+ --label-width: 8rem;
+ --input-width: 15rem;
+ }
+
+ .input-group {
+ display: flex;
+ align-items: center;
+ margin-bottom: 1rem;
+ }
+
+ .input-group label {
+ flex: 0 0 var(--label-width);
+ }
+
+ .input-group .tiny-input {
+ width: var(--input-width);
+ }
|
||
</style> |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -227,7 +227,8 @@ export default { | |||||||||||||||||||||||||||||||||||||||||||||||||
'en-US': 'Memory History Input' | ||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
desc: { | ||||||||||||||||||||||||||||||||||||||||||||||||||
'zh-CN': '<p>参考以下例子,输入完成后,输入会被记住。</p>', | ||||||||||||||||||||||||||||||||||||||||||||||||||
'zh-CN': | ||||||||||||||||||||||||||||||||||||||||||||||||||
'<p>通过组件实例方法 <code> addMemory </code> 添加历史输入数据,输入完成后,输入会被记住。通过 <code> memory-space </code> 属性配置最多可以被记录的条数。</p>', | ||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+230
to
+231
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. Enhance English description to match Chinese content detail. The English description lacks important details about the Consider updating the English description to: -'en-US': '<p>Refer to the following example. After the input is complete, the input will be remembered</p>'
+'en-US': '<p>Use the component instance method <code>addMemory</code> to add historical input data. After the input is complete, the input will be remembered. The <code>memory-space</code> attribute configures the maximum number of records that can be stored.</p>'
|
||||||||||||||||||||||||||||||||||||||||||||||||||
'en-US': '<p>Refer to the following example. After the input is complete, the input will be remembered</p>' | ||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
codeFiles: ['method-addMemory.vue'] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -253,9 +254,15 @@ export default { | |||||||||||||||||||||||||||||||||||||||||||||||||
'en-US': 'Native Attribute' | ||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
desc: { | ||||||||||||||||||||||||||||||||||||||||||||||||||
'zh-CN': '<p>可设置 <code>name</code> <code>disabled</code> <code>readonly</code>等原生属性。</p>\n', | ||||||||||||||||||||||||||||||||||||||||||||||||||
'zh-CN': ` | ||||||||||||||||||||||||||||||||||||||||||||||||||
<p>可设置 <code>name</code> <code>disabled</code> <code>readonly</code>等原生属性。</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||
<div class="tip custom-block"> | ||||||||||||||||||||||||||||||||||||||||||||||||||
<p class="custom-block-title"> 温馨提示: </p> | ||||||||||||||||||||||||||||||||||||||||||||||||||
<p>原生属性是透传给 <code> input </code>原生标签的,功能和使用原生标签等同。</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||
`, | ||||||||||||||||||||||||||||||||||||||||||||||||||
'en-US': | ||||||||||||||||||||||||||||||||||||||||||||||||||
'<p>You can set native attributes such as <code>name</code> <code>disabled</code> <code>readonly</code> . </p>\n' | ||||||||||||||||||||||||||||||||||||||||||||||||||
'<p>You can set native attributes such as <code>name</code> <code>disabled</code> <code>readonly</code> . </p>' | ||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+257
to
+265
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. Add the tip section to English description for consistency. The Chinese description includes a helpful tip about native attributes being passed to the input tag, but this information is missing in the English version. Consider updating the English description to include the tip section: -'en-US': '<p>You can set native attributes such as <code>name</code> <code>disabled</code> <code>readonly</code> . </p>'
+'en-US': `
+ <p>You can set native attributes such as <code>name</code> <code>disabled</code> <code>readonly</code>.</p>
+ <div class="tip custom-block">
+ <p class="custom-block-title">Tip:</p>
+ <p>Native attributes are passed directly to the <code>input</code> native tag and function exactly the same as using native tags.</p>
+ </div>
+` 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
codeFiles: ['native.vue'] | ||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
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.
Inconsistency between Chinese and English descriptions.
The Chinese description has been updated to replace "textarea" with "number", but the English description still mentions "textarea" as an option. This creates a documentation inconsistency that could confuse users.
Apply this diff to align the English description with the Chinese one:
📝 Committable suggestion