0
点赞
收藏
分享

微信扫一扫

前端-vue基础57-局部组件注册


前端-vue基础57-局部组件注册_javascript

 

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<div id="app">
<hello-world></hello-world>
<hello-tom></hello-tom>
<hello-geyao></hello-geyao>
<test-com></test-com>
</div>

<body>
<script type="text/javascript" src="./js/vue.js"></script>
<script>
Vue.component('test-com', {
template: '<div>Test</div>'
})
var HelloWorld = {
data: function() {
return {
msg: 'HelloWorld'
}
},
template: '<div>{{msg}}</div>'
};
var HelloTom = {
data: function() {
return {
msg: 'HelloTom'
}
},
template: '<div>{{msg}}</div>'
};
var HelloGeyao = {
data: function() {
return {
msg: 'HelloGeyao'
}
},
template: '<div>{{msg}}</div>'
};
var vm = new Vue({
el: '#app',
data: {

},
components: {
'hello-world': HelloWorld,
'hello-tom': HelloTom,
'hello-geyao': HelloGeyao
}
});
</script>
</body>

</html>

前端-vue基础57-局部组件注册_vue.js_02

 

举报

相关推荐

0 条评论