console
<!DOCTYPE html>
<html lang="en">
<head>
<title>extends Option 扩展选项</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
<h1>extends Option 扩展选项</h1>
<hr>
<div id="app">
<p>num:${ num }</p>
<P><button @click="add">增加数量</button></P>
</div>
<script type="text/javascript">
var extendsObj = {
updated: function () {
alert("我是扩展的update");
},
methods:{
add: function () {//扩展的方法重名的话不执行
alert("我是扩展的方法");
this.num++;
}
}
}
var app = new Vue({
el: '#app',
data: {
num: 1
},
methods: {
add: function () {
alert("我是原生的方法");
this.num++;
}
},
updated: function () {
alert("我是原生的Update");
},
extends:extendsObj,
delimiters:["${","}"],
})
</script>
</body>
</html>