Skip to content

305 - 大写 #2030

Open
Open
@kid1110

Description

@kid1110
// 你的答案
<script setup>
import { ref,vModelText } from 'vue'
const value = ref("")
vModelText.beforeUpdate = function (el,{value,modifiers}){
  if(value && modifiers.capitalize){
    el.value = el.value.charAt(0).toUpperCase() + el.value.slice(1)
  }
} 
</script>

<template>
  <input type="text" v-model.capitalize="value" />
</template>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions