|
@@ -0,0 +1,52 @@
|
|
|
|
+<!DOCTYPE html>
|
|
|
|
+<html lang="zh">
|
|
|
|
+
|
|
|
|
+<head>
|
|
|
|
+ <title></title>
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
+ <script src="https://unpkg.com/vue/dist/vue.js"></script>
|
|
|
|
+ <link href="../css/style.css" rel="stylesheet"> </head>
|
|
|
|
+<body>
|
|
|
|
+<div id="myApp">
|
|
|
|
+ <h1>用户注册</h1>
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <label for="username">用户:</label>
|
|
|
|
+ <input type="text" id="username" v-model.lazy="username" @change="checkUsername">
|
|
|
|
+ <span v-if="checkUsernameOK">可注册</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <label for="age">年龄:</label>
|
|
|
|
+ <input type="number" id="age" v-model.number="age">
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <label for="content">个人简介:</label><br/>
|
|
|
|
+ <textarea id="content" v-model.trim="content" cols="55" rows="8"></textarea>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <h4>信息区</h4>
|
|
|
|
+ <p>{{username}}</p>
|
|
|
|
+ <p>{{age}}</p>
|
|
|
|
+ <p><pre>{{content}}</pre></p>
|
|
|
|
+</div>
|
|
|
|
+<script>
|
|
|
|
+ var myApp = new Vue({
|
|
|
|
+ el: '#myApp',
|
|
|
|
+ data: {
|
|
|
|
+ username: "",
|
|
|
|
+ checkUsernameOK: false,
|
|
|
|
+ age: "",
|
|
|
|
+ content: "",
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ checkUsername: function(){
|
|
|
|
+ if (this.username.length > 0) this.checkUsernameOK = true;
|
|
|
|
+ else this.checkUsernameOK = false;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+</script>
|
|
|
|
+</body>
|
|
|
|
+
|
|
|
|
+</html>
|