Advertisement
cloudtuts

vue3 v-model

Jun 28th, 2022
904
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html lang="zh-TW">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <title>Vue</title>
  7. </head>
  8.  
  9. <body>
  10. <div id="app">
  11.     <input type="text" name="value" v-model="c.value" />
  12.     ${$root}
  13. </div>
  14.  
  15. <script src="https://unpkg.com/vue@next"></script>
  16. <script>
  17. var $vue;
  18. var vue_data={a:{'value':'abc'}, b:{'value':''}, c:{'value':'123'}};
  19.  
  20. const VM={
  21.     data(){return vue_data;},
  22.     compilerOptions:{delimiters:['${', '}']},
  23.     mounted(){
  24.         console.log('Vue mounted');
  25.     },
  26.     updated(){
  27.         console.log('Vue updated');
  28.     },
  29.     methods:{},
  30.     watch:{},
  31.     computed:{},
  32. }
  33. window.onload=()=>{
  34.     $vue=Vue.createApp(VM).mount('#app');
  35.     $vue.b=$vue.a;
  36.     $vue.c=$vue.a;
  37. }
  38. </script>
  39. </body>
  40. </html>
Advertisement
RAW Paste Data Copied
Advertisement