vue组件-其他
1
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="bower_components/vue/dist/vue.js"></script> <style> </style> </head> <body> <div id="box"> <aaa></aaa> </div> <script> var Aaa=Vue.extend({ data:{ msg:'我是笔筒^_^' }, template:'<h3>{{msg}}</h3>' }); Vue.component('aaa',Aaa); var vm=new Vue({ el:'#box', data:{ bSign:true } }); </script> </body> </html>
2
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="bower_components/vue/dist/vue.js"></script> <style> </style> </head> <body> <div id="box"> <aaa></aaa> </div> <script> var Aaa=Vue.extend({ data(){ return { msg:'我是标题^^' }; }, template:'<h3>{{msg}}</h3>' }); Vue.component('aaa',Aaa); var vm=new Vue({ el:'#box', data:{ bSign:true } }); </script> </body> </html>
3
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="bower_components/vue/dist/vue.js"></script> <style> </style> </head> <body> <div id="box"> <aaa></aaa> </div> <script> var Aaa=Vue.extend({ data(){ return { msg:'我是标题^^' }; }, methods:{ change(){ this.msg='changed' } }, template:'<h3 @click="change">{{msg}}</h3>' }); Vue.component('aaa',Aaa); var vm=new Vue({ el:'#box', data:{ bSign:true } }); </script> </body> </html>