简单写个点击事件
<template>
<div class="app">
<div class="box" @click="fn"></div>
</div>
</template>
<script>
export default {
//导出当前组件的配置项
//里面可以提供 data methods computed watch 生命周期 等
methods: {
fn () {
alert('click')
}
},
name: 'app'
}
</script>
<style>
.app {
width: 400px;
height: 400px;
background-color: antiquewhite;
}
.app .box{
width: 100px;
height: 100px;
background-color: aquamarine;
}
</style>