Vue introduction series: jQuery in twenty Vue
Sao Nian 2020-11-25 23:35:09
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="./asset/jquery.min.js"></script> <script src="./asset/vue.js"></script> <title>Vuejs</title></head><body> <div id="app"> <div id="#app"> {{ msg }} </div> </div> </body><script> var app=new Vue({ el:'#app', data:{ msg:' Hello everyone , I'm Zhang Wuji ' }, methods:{ }, mounted(){ let app_dom = $('#app').text(); console.log('app_dom',app_dom); $('#app').text(' Hello everyone , I'm Zhang Sanfeng '); } })</script></html>



Vue Introductory series : twenty Vue Use in Jquery


Page output


Vue Introductory series : twenty Vue Use in Jquery


Console output


Vue Introductory series : twenty Vue Use in Jquery


analysis
  • We used vue And declare periodic functions mounted Method
  • When the page is mounted , We make use of jquery Can be obtained div(#app) The original content is " Hello everyone , My name is Zhang Wuji "
  • It was then used jquery Change the content to " Hello everyone , My name is Zhang Sanfeng "
  • therefore jquery Can be in vue It uses
版权声明
本文为[Sao Nian]所创,转载请带上原文链接,感谢
https://fheadline.com/2020/11/20201125233237800u.html
相似文章

2021-08-09