xml
复制代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>构造器 Vue.extend</title>
<script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
<h1>构造器 Vue.extend</h1>
<hr>
<author></author>
</body>
</html>
<script>
//构造器
var authorExtend = Vue.extend({
template:'<p><a :href="authorUrl" >{{authorName}}</a> </p>',
data:function(){
return{
authorName:'Json',
authorUrl:'http://www.baidu.com'
}
}
})
//加载到标签 绑定 $mount 也可以绑定 id class 或者之前绑定标签
new authorExtend().$mount('author')
</script>