Vue.js注册组件

Posted 醉半仙

tags:

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

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vue.js Hello World!</title>
<script type="text/javascript" src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
</head>
<body>
<div id="example">
<my-component></my-component>
</div>
<script type="text/javascript">
// 注册
Vue.component(‘my-component‘, {
template: ‘<div>A custom component!</div>‘
})
// 创建根实例
new Vue({
el: ‘#example‘
})
</script>
</body>
</html>























以上是关于Vue.js注册组件的主要内容,如果未能解决你的问题,请参考以下文章

vue.js基础知识篇:组件详解

Vue.js 组件注册

Vue.js注册组件

Vue.js---组件

vue.js注册引用全局消息组件

Vue.js之组件嵌套