vue.js表单提交


<!DOCTYPE html> 
<html lang="en"> 
    <head> 
        <meta charset="UTF-8"> 
        <title>helloform_Vue</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <script src="./vue.js"></script> 
    </head> 
    <body> 
    <div class="hello"> 
        <ul> 
            <form @submit.prevent="submit"> 
                <input type="text" name="name" v-model="inputtext.name"> 
                <input type="password" name="password" v-model="inputtext.password"> 
                <input type="submit" value="提交"> 
            </form> 
        </ul> 
    </div> 
    <script> 
        var vm = new Vue({ 
            el: '.hello', 
            data: { 
                 
                inputtext:{} 
            }, 
            methods: { 
                submit: function() { 
                    console.log(this.inputtext); 
                } 
            }, 
        }) 
    </script> 
 
    </body> 
</html> 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM