Skip to content
On this page

Password 密码输入框

说明

可使用ref获取到组件的引用,并通过引用获取到validate函数来触发验证。

举例

vue
<template>
    <el-card shadow="never" style="height: 100%">
        <el-form style="width: 30%">
            <Password ref="passwordRef" v-model="form.password" />
        </el-form>

        <el-button type="primary" @click="() => passwordRef.validate()">验证密码</el-button>
    </el-card>
</template>

<script setup lang="ts">
import { reactive, ref } from "vue";
import Password from "@/components/password/index.vue";

const form = reactive({ password: "" });
const passwordRef = ref();
</script>

<style scoped></style>

API

Props

参数说明类型默认值可选值
model-value/v-model当前输入的密码string--

Events

事件名说明参数
validate当前输入的密码是否验证通过validate:boolean

Released under the MIT License.