国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

vue復合組件實現注冊表單功能

2024-05-06 15:24:47
字體:
來源:轉載
供稿:網友

本文實例為大家分享了vue注冊表單的具體代碼,供大家參考,具體內容如下

<!doctype html><html> <head> <meta charset="UTF-8"> <title></title>  <script src="js/vue.js"></script> </head> <body> <div id="container">    <p>{{msg}}</p>    <my-article></my-article>  </div>  <script>    //要采用組件化的方式來編寫頁面,  // 把任何一個可被重用的元素封裝成組件  // everything is component  Vue.component("my-title",{    template:`<div>          <h1>清風手紙</h1>          <h4>原木</h4>    </div>`  })  Vue.component("my-content",{  //一個就可以用引號或者``    template:'<p>源于純凈,歸于健康</p>'  })  Vue.component("my-article",{    //當調用多個組件時要用``符號,而且要用頂層標簽包含    template:`      <div>        <my-title></my-title>        <my-content></my-content>      </div>    `  })    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> <div id="container">    <p>{{msg}}</p>    <!--調用根組件 -->    <my-form></my-form>  </div>  <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、div等……      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>            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 富锦市| 苍溪县| 安图县| 雷州市| 泗水县| 那曲县| 蒙山县| 竹山县| 高青县| 马公市| 柳江县| 神池县| 曲靖市| 尤溪县| 丹寨县| 堆龙德庆县| 长宁县| 平凉市| 宜州市| 房山区| 博野县| 抚顺县| 革吉县| 永州市| 莆田市| 永靖县| 宝鸡市| 土默特左旗| 邢台市| 长沙县| 湘潭县| 宣城市| 广汉市| 玉溪市| 镇赉县| 溧水县| 内丘县| 武乡县| 新建县| 兰州市| 阳东县|