docs: add demo

This commit is contained in:
btea
2023-03-15 11:27:33 +08:00
parent db5f2fda1f
commit aa7a40bf9d
2 changed files with 35 additions and 0 deletions

View File

@@ -115,6 +115,14 @@ input/length-limiting
:::
## Count graphemes
:::demo Set `count-graphemes` to `true` to count graphemes of input value. If it's set, native `maxlength` and `minlength` won't be used.
input/count-graphemes
:::
## API
### Attributes

View File

@@ -0,0 +1,27 @@
<template>
<el-input
v-model="text"
maxlength="10"
placeholder="Please input"
show-word-limit
:count-graphemes="calc"
type="text"
/>
<div style="margin: 20px 0" />
<el-input
v-model="textarea"
maxlength="20"
placeholder="Please input"
show-word-limit
type="textarea"
/>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const text = ref('😀😁')
const textarea = ref('😀😁')
const calc = (value: string) => {
return Array.from(value).length
}
</script>