自定义标签
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/vue.js" ></script>
<style>
youxin {
width: 100px;
height: 100px;
/*** 自定义标签必须设置display: block ***/
display: block;
}
</style>
</head>
<body>
<div id="box">
<youxin></youxin>
</div>
</body>
<script>
window.onload=function(){
Vue.elementDirective('youxin',{
bind: function(){
this.el.style.background = 'red';
}
})
var vm = new Vue({
el: '#box'
});
}
</script>
</html>