<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
<author id="authorContent"></author>
</div>
<script src="./node_modules/vue/dist/vue.js"></script>
<script>
var authorExtend = Vue.extend({
template: `
<div>
<a :href="authorLink">{{ author }}</a>
</div>
`,
data() {
return {
authorLink: 'http:www.baidu.com',
author: '百度'
}
}
});
// 将扩展实例构造器挂载到html的author标签上
new authorExtend().$mount('author');
// 或者用类似jquery选择器的方法挂载
// new authorExtend().$mount('#authorContent');
</script>
</body>
</html>