一 概念

```html
<div id='app'>
    <p v-on:click='func'>{{ msg }}</p>
</div>
<script>
    new Vue({
    	el: '#app',
    	data: {
    		msg: '段落'
    	},
        methods: {
            func: function() {
                alert(this.msg)
            }
        }
    })
</script>
```

二 代码示范

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>methods</title>
<style type="text/css">
.box {
background-color: orange
}
</style>
</head>
<body>
<div );
}
}
})
</script>
</html>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-06-16
  • 2021-11-20
  • 2021-11-19
  • 2021-08-06
猜你喜欢
  • 2022-01-07
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案