


Detailed example of Vue composite component to implement registration form function
Dec 26, 2017 pm 02:05 PMThis article mainly introduces the Vue composite component to realize the registration form function in detail. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.
<!doctype html> <html> <head> <meta charset="UTF-8"> <title></title> <script src="js/vue.js"></script> </head> <body> <p id="container"> <p>{{msg}}</p> <my-article></my-article> </p> <script> //要采用组件化的方式来编写页面, // 把任何一个可被重用的元素封装成组件 // everything is component Vue.component("my-title",{ template:`<p> <h1>清风手纸</h1> <h4>原木</h4> </p>` }) Vue.component("my-content",{ //一个就可以用引号或者`` template:'<p>源于纯净,归于健康</p>' }) Vue.component("my-article",{ //当调用多个组件时要用``符号,而且要用顶层标签包含 template:` <p> <my-title></my-title> <my-content></my-content> </p> ` }) new Vue({ el:"#container", data:{ msg:"Hello VueJs" } }) </script> </body> </html>
<!doctype html> <html> <head> <meta charset="UTF-8"> <title></title> <script src="js/vue.js"></script> </head> <body> <p id="container"> <p>{{msg}}</p> <!--调用根组件 --> <my-form></my-form> </p> <script> //创建组件my-user Vue.component("my-user",{ template:` <label>用户名:</label> ` }) Vue.component("user-input",{ template:` <input type="text" placeholder="请输入用户名"/> ` }) Vue.component("my-pwd",{ template:` <label>密码:</label> ` }) Vue.component("pwd-input",{ template:` <input type="text" placeholder="请输入密码"/> ` }) Vue.component("my-login",{ template:` <button>登录</button> ` }) Vue.component("my-resign",{ template:` <button>注册</button> ` }) //复合组件作为根组件名字必须是烤串式的,驼峰的会报错 Vue.component("my-form",{ //可以用table、form、p等…… template:` <form> <my-user></my-user> <user-input></user-input> <br> <my-pwd></my-pwd> <pwd-input></pwd-input> <br> <my-resign></my-resign> <my-login></my-login> //写法或者 <my-login/> </form> ` }) new Vue({ el:"#container", data:{ msg:"Hello VueJs" } }) </script> </body> </html>
Related recommendations:
How to use html and css to implement the registration form A simple example
How to implement the verification of the registration form in JavaScript Example analysis (picture)
Using jQuery validate to verify the registration form Example_ jquery
The above is the detailed content of Detailed example of Vue composite component to implement registration form function. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to install the Windows 10 old version component DirectPlay

How to implement dual WeChat login on Huawei mobile phones?

Use Java to write code to implement love animation

How to implement the WeChat clone function on Huawei mobile phones

PHP Programming Guide: Methods to Implement Fibonacci Sequence

PHP Game Requirements Implementation Guide

Angular components and their display properties: understanding non-block default values

Master how Golang enables game development possibilities
