1. <div @click="handleClick">{{msg}}</div>
    2. <script>
    3. export default {
    4. name: "app",
    5. data() {
    6. return {
    7. msg: "hello world",
    8. };
    9. },
    10. //事件集中写在methods属性中
    11. methods:{
    12. handleClick(){
    13. this.msg = "change"
    14. }
    15. }
    16. };
    17. </script>
    1. @click.native //给组件事件必须加上native修饰符