事件
- html
<div id="app">
<button @click="show($event)">点击按钮会显示当前坐标</button>
<button @click="show2(message)">点击按钮会显示一个vue变量</button>
</div>
- js
<script>
// 初始化数据
window.onload = function () {
// vue
var vueApp = new Vue({
el: '#app',
data: {message: '这里是测试内容'},
methods: {
show: function (ev) {
alert(ev.clientX + "," + ev.clientY);
},
show2: function (msg) {
alert(msg);
}
}
});
};
</script>