layui-vue3实现表单验证效果代码

代码语言:html

所属分类:验证

代码描述:layui-vue3实现表单验证效果代码

代码标签: layui-vue 实现 表单 验证 layui vue3

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Document</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- 引入 layui-vue 样式 -->
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/layui-vue.css">
    <!-- 引入 Vue 3, 使用全局变量 Vue -->
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue.global.3.2.33.js"></script>
    <!-- 引入 layui-vue 组件库, 使用全局变量 LayuiVue -->
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/layui-vue.js"></script>
</head>

<body>
    <div id="app" style="padding:20px;">
        <lay-form :model="validateModel" ref="layFormRef" required>
    <lay-form-item label="账户" prop="username">
      <lay-input v-model="validateModel.username"></lay-input>
    </lay-form-item>
    <lay-form-item label="密码" prop="password">
      <lay-input v-model="validateModel.password" type="password">></lay-input>
    </lay-form-item>
    <lay-form-item label="爱好" prop="hobby">
      <lay-select v-model="validateModel.hobby" multiple>
        <lay-select-option value="1" label="学习"></lay-select-option>
        <lay-select-option value="2" label="编码"></lay-select-option>
        <lay-select-option value="3" label="运动"></lay-select-option>
      </lay-select>
    </lay-form-item>
    <lay-form-item label="特长" prop="specialty">
      <lay-radio v-model="validateModel.specialty" name="specialty" value="1">写作</lay-radio>
      <lay-radio v-model="validateModel.specialty" name="specialty" value="2">画画</lay-radio>
      <lay-radio v-model="va.........完整代码请登录后点击上方下载按钮下载查看

网友评论0