Skip to content
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

[Component] [input, form] Result for characters calculate in el-input and in validation rules are different when unicode emoji in text #16756

Closed
tyuterry opened this issue May 6, 2024 · 1 comment · Fixed by #16757

Comments

@tyuterry
Copy link

tyuterry commented May 6, 2024

Bug Type: Component

Environment

  • Vue Version: 3.4.26
  • Element Plus Version: 2.7.2
  • Browser / OS: Chrome/124.0.0.0
  • Build Tool: Vite

Reproduction

Related Component

  • el-input
  • el-form

Reproduction Link

Element Plus Playground

Steps to reproduce

<template>
  <el-form
    ref="ruleFormRef"
    style="max-width: 600px"
    :model="ruleForm"
    :rules="rules"
  >
    <el-form-item label="name" prop="name">
      <el-input v-model="ruleForm.name" :show-word-limit="true" :maxlength="20" />
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue'
import type { ComponentSize, FormInstance, FormRules } from 'element-plus'

interface RuleForm {
  name: string
}

const ruleFormRef = ref<FormInstance>()
const ruleForm = reactive<RuleForm>({
  name: '🥲'
})


const rules = reactive<FormRules<RuleForm>>({
  name: [
    { min: 2, message: 'el-input calculate character 2 but form rules think is 1', trigger: ['blur','change'] },
  ]
})


onMounted(()=>{
  ruleFormRef.value.validate()
})
</script>

What is Expected?

characters calculate result should be same

What is actually happening?

el-input calculate character is 2 but form rules think is 1

Additional comments

(empty)

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

此 issue 已被自动锁定,因为关闭后没有任何近期活动。如果有相关 bug,请重新创建一个新 issue。

@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant