博客
关于我
Vue.js的学习1.1
阅读量:107 次
发布时间:2019-02-26

本文共 1061 字,大约阅读时间需要 3 分钟。

Vue.js的学习1.1

1.今天学习的是关于事件的一些小东西。

昨天有学习到绑定事件可以用—> v-on:click/mouseover……
简写的:
@click=”” 推荐

事件对象:

@click="show($event)"

事件冒泡:

阻止冒泡:          a). ev.cancelBubble=true;  (这个比较难记,我经常记不全)        b). **@click.stop** 推荐

2.默认行为

阻止默认行为:

a). ev.preventDefault();        b). **@contextmenu.prevent**    推荐

键盘:

@keydown    $event ev.keyCode    @keyup

常用键:

看到这个的时候我真的是amazing…..老哥,厉害呀 …呀。记得以前写原生的时候可麻烦了,先获取键盘的按键,再判断啥子的….em…

回车    a). @keyup.13    b). @keyup.enter上、下、左、右    @keyup/keydown.left    @keyup/keydown.right    @keyup/keydown.up    @keyup/keydown.down

3.属性:

用这个绑定属性 v-bind:src=””
width/height/title….

简写:

:src=”” 推荐

  效果能出来,但是会报一个404错误   效果可以出来,不会发404请求

class和style:

:class=""   -----》v-bind:class="":style=""   -----》 v-bind:style="":class="[red]"  red是数据:class="[red,b,c,d]":class="{red:a, blue:false}"推荐::class="json"       data:{        json:{red:a, blue:false}    }--------------------------style::style="[c]":style="[c,d]"推荐:data:{      json:{           color:'red',           backgroundColor:'gray'  注意:  复合样式,采用驼峰命名法       }            }       :style="json"

转载地址:http://dhqu.baihongyu.com/

你可能感兴趣的文章
nginx+mysql+redis+mongdb+rabbitmq 自动化部署脚本
查看>>
nginx+php的搭建
查看>>
nginx+tomcat+memcached
查看>>
nginx+tomcat单个域名及多个域名配置
查看>>
Nginx+Tomcat实现动静分离
查看>>
nginx+Tomcat性能监控
查看>>
nginx+uwsgi+django
查看>>
nginx+vsftp搭建图片服务器
查看>>
Nginx-http-flv-module流媒体服务器搭建+模拟推流+flv.js在前端html和Vue中播放HTTP-FLV视频流
查看>>
nginx-vts + prometheus 监控nginx
查看>>
Nginx/Apache反向代理
查看>>
Nginx: 413 – Request Entity Too Large Error and Solution
查看>>
nginx: [emerg] getpwnam(“www”) failed 错误处理方法
查看>>
nginx: [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:
查看>>
nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
查看>>
nginx:Error ./configure: error: the HTTP rewrite module requires the PCRE library
查看>>
Nginx:objs/Makefile:432: recipe for target ‘objs/src/core/ngx_murmurhash.o‘解决方法
查看>>
nginxWebUI runCmd RCE漏洞复现
查看>>
nginx_rtmp
查看>>
Vue中向js中传递参数并在js中定义对象并转换参数
查看>>