美文网首页
02-Vue之form提交

02-Vue之form提交

作者: 木易先生灬 | 来源:发表于2018-09-22 08:51 被阅读0次
    <!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>

    ---------------------

    本文来自 CSDN 博客 ,全文地址请点击:https://blog.csdn.net/u010674395/article/details/73028691?utm_source=copy 

相关文章

网友评论

      本文标题:02-Vue之form提交

      本文链接:https://www.haomeiwen.com/subject/jfmtoftx.html