<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>组件定义</title>
<link rel="stylesheet" type="text/css" href="css/animate.css">
</head>
<script type="text/javascript" src="js/vue.js" ></script>
<body>
<div id="div1">
<my-hello></my-hello>
</div>
</body>
<script>
Vue.component(‘my-hello‘,{
template: ‘<h1>hello world!</h1>‘
});
let vm = new Vue({
el: "#div1",
data:{
flag:false
},
});
</script>
</html>
原文地址:http://blog.51cto.com/3miao/2058783
时间: 2024-11-08 03:06:11