Skip to content

Commit

Permalink
feat(search): [search] Increase input maximum character limit attribu…
Browse files Browse the repository at this point in the history
…te maxlength
  • Loading branch information
chenxi-20 committed Mar 1, 2024
1 parent 41fa0ce commit ebe0c07
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
11 changes: 11 additions & 0 deletions examples/sites/demos/apis/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ export default {
pcDemo: 'events',
mfDemo: ''
},
{
name: 'maxlength',
type: 'number',
defaultValue: '',
desc: {
'zh-CN': 'input 框的原生属性,限制最大输入字符数【3.14.0新增】',
'en-US': 'The native properties of the input box limit the maximum number of input characters[New 3.14.0]'
},
mode: ['pc'],
pcDemo: 'basic-usage'
},
{
name: 'mini',
type: 'boolean',
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/search/basic-usage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<tiny-search v-model="value" placeholder="请输入关键词"></tiny-search>
<tiny-search v-model="value" placeholder="请输入关键词" :maxlength="10"></tiny-search>
<div class="mt10">当前搜索值为:{{ value }}</div>
</div>
</template>
Expand Down
5 changes: 3 additions & 2 deletions examples/sites/demos/pc/app/search/webdoc/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export default {
'en-US': 'Basic Usage'
},
desc: {
'zh-CN': '通过 <code>v-model</code> 设置双向绑定搜索值, <code>placeholder</code> 设置默认占位符文本。',
'zh-CN':
'通过 <code>v-model</code> 设置双向绑定搜索值, <code>placeholder</code> 设置默认占位符文本, <code>input</code>元素的原生属性<code>maxlength</code> 设置输入框最大输入字符长度。',
'en-US':
'Set bidirectional binding search values through <code>v-model</code> , and set default placeholder text through <code>placeholder</code> .'
'Set bidirectional binding search values through <code>v-model</code> , and set default placeholder text through <code>placeholder</code> The native attribute of the <code>input</code> element<code>maxlength</code>sets the maximum input character length of the input box.'
},
codeFiles: ['basic-usage.vue']
},
Expand Down
3 changes: 2 additions & 1 deletion packages/vue/src/search/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export const searchProps = {
default: 'small'
},
typeValue: Object,
suffixIcon: [Object, String]
suffixIcon: [Object, String],
maxlength: Number
}

export default defineComponent({
Expand Down
4 changes: 3 additions & 1 deletion packages/vue/src/search/src/pc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
</transition>
<input
ref="input"
:maxlength="maxlength"
v-model="state.currentValue"
:style="
transparent
Expand Down Expand Up @@ -110,7 +111,8 @@ export default defineComponent({
'clearable',
'isEnterSearch',
'typeValue',
'size'
'size',
'maxlength'
],
emits: ['change', 'search', 'update:modelValue', 'clear', 'select', 'input'],
components: {
Expand Down

0 comments on commit ebe0c07

Please sign in to comment.