最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue實(shí)現(xiàn)注冊(cè)頁面的用戶交互詳解

 更新時(shí)間:2023年12月08日 13:51:34   作者:聽風(fēng)與他  
這篇文章主要為大家詳細(xì)介紹了Vue實(shí)現(xiàn)注冊(cè)頁面的用戶交互的相關(guān)知識(shí),文中的示例代碼講解詳細(xì),對(duì)我們深入掌握vue有一定的幫助,需要的小伙伴可以參考下

Vue代碼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用戶注冊(cè)</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        .container {
            margin:0 auto;
            margin-top: 70px;
            text-align: center;
            width: 300px;
        } 
        .subTitle {
            color:gray;
            font-size: 14px;
        }  
        .title {
            font-size: 45px;  
        }
        .input {
            width: 90%;
        }
        .inputContainer {
            text-align: left;
            margin-bottom: 20px;
        }
        .subContainer {
            text-align: left;
        }
        .field {
            font-size: 14px;
        }
        .input {
            border-radius: 6px;
            height: 25px;
            margin-top: 10px;
            border-color: silver;
            border-style: solid;
            background-color: cornsilk;
        }
        .tip {
            margin-top: 5px;
            font-size: 12px;
            color: gray;
        }
        .setting {
            font-size: 9px;
            color: black;
        }
        .label {
            font-size: 12px;
            margin-left: 5px;
            height: 20px;
            vertical-align:middle;
        }
        .checkbox {
            height: 20px;
            vertical-align:middle;
        }
        .btn {
            border-radius: 10px;
            height: 40px;
            width: 300px;
            margin-top: 30px;
            background-color: deepskyblue;
            border-color: blue;
            color: white;
        }
    </style>
</head>
<body>
    <div class="container" id="Application">
        <div class="container">
            <div class="subTitle">加入我們,一起創(chuàng)造美好世界</div>
            <h1 class="title">創(chuàng)建你的賬號(hào)</h1>
            <div v-for="(item, index) in fields" class="inputContainer">
                <div class="field">{{item.title}} 
                    <span v-if="item.required" style="color: red;">*</span></div>
                <input v-model="item.model" class="input" :type="item.type" />
                <div class="tip" v-if="index == 2">請(qǐng)確認(rèn)密碼程度需要大于6位</div>
            </div>
            <div class="subContainer">
                <div class="setting">偏好設(shè)置</div>
                <input v-model="receiveMsg" class="checkbox" type="checkbox" /><label class="label">接收更新郵件</label>
            </div>
            <button @click="createAccount" class="btn">創(chuàng)建賬號(hào)</button>
        </div>
    </div>
    <script>
        const App = {
            data(){
                return{
                    fields:[
                        {
                            title:'用戶名',
                            required:true,
                            type:'text',
                            model:''//與輸入框雙向綁定的數(shù)據(jù)
                        },
                        {
                            title:'郵箱地址',
                            required:false,
                            type:'text',
                            model:''//與輸入框雙向綁定的數(shù)據(jù)
                        },{
                            title:'密碼',
                            required:true,
                            type:'password',
                            model:''//與輸入框雙向綁定的數(shù)據(jù)
                        }
                    ],
                    receiveMsg:false
                }
            },
            computed:{
                //定義"賬號(hào)"計(jì)算屬性,獲取值與設(shè)置值時(shí)同步映射到data中具體的存儲(chǔ)屬性
                name:{
                    get(){
                        return this.fields[0].model
                    },
                    set(value){
                        this.fields[0].model = value
                    }
                },
                //定義"郵箱"計(jì)算屬性,獲取值與設(shè)置值時(shí)同步映射到data中具體的存儲(chǔ)屬性
                email:{
                    get(){
                        return this.fields[1].model
                    },
                    set(value){
                        this.fields[1].model = value
                    }
                },
                password:{
                    get(){
                        return this.fields[2].model
                    },
                    set(value){
                        this.fields[2].model = value
                    }
                },
            },
            methods:{
                //檢查郵箱格式是否正確
                emailCheck(){
                    var verify = /^\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/;
                    if(!verify.test(this.email)){
                        return false
                    }else{
                        return true
                    }
                },
                //模擬業(yè)務(wù)上的注冊(cè)操作
                createAccount(){
                    if(this.name.length == 0){
                        alert('請(qǐng)輸入用戶名')
                        return
                    }else if(this.password.length <= 6){
                        alert('密碼設(shè)置需要大于6位字符')
                        return
                    }else if(this.email.length > 0 && !this.emailCheck(this.email)){
                        alert('請(qǐng)輸入正確的郵箱')
                        return
                    }
                    alert('注冊(cè)成功')
                    console.log(`name:${this.name}\npassword:${this.password}\nemail:${this.email}\nreceiveMsg:${this.receiveMsg}`)
                }
            }
        }
        Vue.createApp(App).mount("#Application") 
    </script>
</body>
</html>

實(shí)現(xiàn)效果

控制臺(tái)上打印注冊(cè)信息

到此這篇關(guān)于Vue實(shí)現(xiàn)注冊(cè)頁面的用戶交互詳解的文章就介紹到這了,更多相關(guān)Vue注冊(cè)頁面用戶交互內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Vue+Element-ui彈窗?this.$alert?is?not?a?function問題

    Vue+Element-ui彈窗?this.$alert?is?not?a?function問題

    這篇文章主要介紹了Vue+Element-ui彈窗?this.$alert?is?not?a?function問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • 如何通過Vue自定義指令實(shí)現(xiàn)前端埋點(diǎn)詳析

    如何通過Vue自定義指令實(shí)現(xiàn)前端埋點(diǎn)詳析

    埋點(diǎn)分析是網(wǎng)站分析的一種常用的數(shù)據(jù)采集方法,下面這篇文章主要給大家介紹了關(guān)于如何通過Vue自定義指令實(shí)現(xiàn)前端埋點(diǎn)的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-07-07
  • 詳解Vue+Element的動(dòng)態(tài)表單,動(dòng)態(tài)表格(后端發(fā)送配置,前端動(dòng)態(tài)生成)

    詳解Vue+Element的動(dòng)態(tài)表單,動(dòng)態(tài)表格(后端發(fā)送配置,前端動(dòng)態(tài)生成)

    這篇文章主要介紹了Vue+Element動(dòng)態(tài)表單動(dòng)態(tài)表格,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • 淺談Vue+Ant Design form表單的一些坑

    淺談Vue+Ant Design form表單的一些坑

    本文主要介紹了淺談Vue+Ant Design form表單的一些坑,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-06-06
  • 淺析Vue中混入mixin的實(shí)現(xiàn)

    淺析Vue中混入mixin的實(shí)現(xiàn)

    混入 (mixin) 提供了一種非常靈活的方式,來分發(fā) Vue 組件中的可復(fù)用功能,下面就跟隨小編一起來了解一下Vue中混入mixin的實(shí)現(xiàn)吧
    2024-11-11
  • Vue?插槽?Slots源碼解析與用法詳解

    Vue?插槽?Slots源碼解析與用法詳解

    這篇文章主要介紹了Vue?插槽?(Slots)?源碼解析與用法,通過實(shí)例,我們?nèi)媪私饬四J(rèn)插槽、具名插槽和作用域插槽的用法,并深入理解了其在Vue源碼中的實(shí)現(xiàn)原理,需要的朋友可以參考下
    2024-01-01
  • vue3實(shí)現(xiàn)ai聊天對(duì)話框功能

    vue3實(shí)現(xiàn)ai聊天對(duì)話框功能

    這篇文章主要介紹了vue3實(shí)現(xiàn)ai聊天對(duì)話框功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),感興趣的朋友一起看看吧
    2024-12-12
  • Vue中使用sass實(shí)現(xiàn)換膚功能

    Vue中使用sass實(shí)現(xiàn)換膚功能

    這篇文章主要介紹了Vue中使用sass實(shí)現(xiàn)換膚功能,實(shí)現(xiàn)此功能用到了三個(gè)主要文件(base.scss、mixin.scss、varibale.scss),需要的朋友可以參考下
    2018-09-09
  • vue中v-for循環(huán)選中點(diǎn)擊的元素并對(duì)該元素添加樣式操作

    vue中v-for循環(huán)選中點(diǎn)擊的元素并對(duì)該元素添加樣式操作

    這篇文章主要介紹了vue中v-for循環(huán)選中點(diǎn)擊的元素并對(duì)該元素添加樣式操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • vue.js響應(yīng)式原理解析與實(shí)現(xiàn)

    vue.js響應(yīng)式原理解析與實(shí)現(xiàn)

    這篇文章主要為大家詳細(xì)介紹了vue.js響應(yīng)式原理解析與實(shí)現(xiàn),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-08-08

最新評(píng)論

板桥市| 潞西市| 新建县| 岢岚县| 洱源县| 陕西省| 勐海县| 高淳县| 凯里市| 马龙县| 长丰县| 江津市| 冀州市| 宁陵县| 中西区| 沾益县| 绵竹市| 舟曲县| 渝北区| 抚州市| 阿尔山市| 沅江市| 新晃| 剑河县| 晴隆县| 句容市| 黄大仙区| 阿合奇县| 萨迦县| 探索| 晋中市| 中宁县| 同德县| 柞水县| 临高县| 田阳县| 依兰县| 巴林右旗| 呼图壁县| 涡阳县| 托克逊县|