vue再读13-系统指令v-on

简介: vue再读13-系统指令v-on
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 数据渲染界面 -->
    <div id="abc">
        {{count}}
        <button v-on:click="count=count+10">按钮1</button>
        <button v-on:click="fn2()">按钮2</button>
        <button v-on:click="fn2()">按钮3</button>
        <button @click="fn5(1000)">按钮4</button>
        <button @click="fn5(1000)">按钮5</button>
        <!-- 当前的事物对象 -->
        <button @click="fn6($event)">按钮6</button>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        var vm = new Vue({
            //v-on里面的methods方法
            el: '#abc',
            //模板ajax返回的数据
            data: {
                msg: '我是歌谣',
                count: 10
            },
            methods: {
                fn2: function() {
                    console.log('fn.....')
                },
                fn5: function(x) {
                    console.log(x);
                },
                fn6(e) {
                    console.log(e);
                }
            }
        })
    </script>
</body>
</html>

image.png

相关文章
|
1天前
|
JavaScript
Vue实战-组件通信
Vue实战-组件通信
4 0
|
1天前
|
JavaScript
Vue实战-将通用组件注册为全局组件
Vue实战-将通用组件注册为全局组件
5 0
|
1天前
|
JavaScript 前端开发
vue的论坛管理模块-文章评论02
vue的论坛管理模块-文章评论02
|
1天前
|
JavaScript Java
vue的论坛管理模块-文章查看-01
vue的论坛管理模块-文章查看-01
|
2天前
|
JavaScript
vue页面加载时同时请求两个接口
vue页面加载时同时请求两个接口
|
2天前
|
JavaScript
vue里样式不起作用的方法,可以通过deep穿透的方式
vue里样式不起作用的方法,可以通过deep穿透的方式
|
2天前
|
移动开发 JavaScript 应用服务中间件
vue打包部署问题
Vue项目`vue.config.js`中,`publicPath`设定为&quot;/h5/party/pc/&quot;,在线环境基于打包后的`dist`目录,而非Linux的`/root`。Nginx代理配置位于`/usr/local/nginx/nginx-1.13.7/conf`,包含两个相关配置图。
vue打包部署问题
|
数据库
基于springboot+mybatisplus+vue的课程学分管理系统
基于springboot+mybatisplus+vue的课程学分管理系统
104 0
基于springboot+mybatisplus+vue的课程学分管理系统
基于Springboot+MybatisPlus+Vue的在线课程管理系统
基于Springboot+MybatisPlus+Vue的在线课程管理系统
110 0
基于Springboot+MybatisPlus+Vue的在线课程管理系统
|
JavaScript 前端开发 Java
基于Springboot+MybatisPlus+Vue的前后端分离的学生选课课程教务管理系统
基于Springboot+MybatisPlus+Vue的前后端分离的学生选课课程教务管理系统
185 0
基于Springboot+MybatisPlus+Vue的前后端分离的学生选课课程教务管理系统