element-plus [TypeScript] [input] ElInput没有明确给出maxlength/minlength的props

4xrmg8kj  于 5个月前  发布在  TypeScript
关注(0)|答案(3)|浏览(159)

Bug Type: TypeScript

Environment

  • Vue Version: 3.2.40
  • Element Plus Version: 2.2.28
  • Browser / OS: Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24 windows11
  • Build Tool: Vite

Reproduction

  • el-input

Element Plus Playground

Steps to reproduce

<script lang="jsx">
import { ElInput } from 'element-plus';
import { defineComponent, ref } from 'vue';

const max = ref('')

export default defineComponent({
setup() {
return <ElInput v-model={max} maxlength="50" showWordLimit={true}></ElInput>  
}
})
</script>

What is Expected?

没有ts报错

What is actually happening?

有ts报错

Additional comments

(empty)

j2qf4p5b

j2qf4p5b1#

使用kebab-case的传值

Source:

  • https://vuejs.org/guide/essentials/component-basics.html#in-dom-template-parsing-caveats
  • https://vuejs.org/guide/components/props.html#prop-name-casing
<script lang="jsx">
import { ElInput } from 'element-plus';
import { defineComponent, ref } from 'vue';

const max = ref('')

export default defineComponent({
setup() {
return <ElInput v-model={max} max-length="50" show-word-limit={true}></ElInput>  
}
})
</script>
hfyxw5xn

hfyxw5xn2#

使用kebab-case的传值

Source:

  • https://vuejs.org/guide/essentials/component-basics.html#in-dom-template-parsing-caveats
  • https://vuejs.org/guide/components/props.html#prop-name-casing
<script lang="jsx">
import { ElInput } from 'element-plus';
import { defineComponent, ref } from 'vue';

const max = ref('')

export default defineComponent({
    setup() {
        return <ElInput v-model={max} max-length="50" show-word-limit={true}></ElInput>  
    }
})
</script>

it isn't effective if using "max-length", because it is not an attribute of

6psbrbz9

6psbrbz93#

使用kebab-case的传值
Source:

  • https://vuejs.org/guide/essentials/component-basics.html#in-dom-template-parsing-caveats
  • https://vuejs.org/guide/components/props.html#prop-name-casing
<script lang="jsx">
import { ElInput } from 'element-plus';
import { defineComponent, ref } from 'vue';

const max = ref('')

export default defineComponent({
    setup() {
        return <ElInput v-model={max} max-length="50" show-word-limit={true}></ElInput>  
    }
})
</script>

it isn't effective if using "max-length", because it is not an attribute of

如果使用 “max-length” 则无效,因为它不是 的属性关闭

oops, sorry my fault

相关问题