vue.components

Posted 苏格拉的底

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue.components相关的知识,希望对你有一定的参考价值。

在这里插入图片描述

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="vue.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="app">
	<button-counter></button-counter>
	<test></test>
</div>
<script type="text/javascript">
Vue.component('button-counter', {
	props: ['title'],
	data: function () {
		return {}
	},
	template: '<div><h1>hi...</h1></div>',
	methods:{
		
	}
})
var vm = new Vue({
	el : "#app",
	data : {
		
	},
	methods:{
		clicknow : function (e) {
			console.log(e);
		}
	},
	components:{
		test : {
			template:"<h2>h2...</h2>"
		}
	}
});
</script>
<style type="text/css">

</style>
</body>
</html>

以上是关于vue.components的主要内容,如果未能解决你的问题,请参考以下文章