el-input 使用 回车键会刷新页面的问题
使用
el-input
的时候,光标聚焦在输入框,按下回车,会刷新页面。这是因为当el-form
表单中只有一个 input 时,按下回车建会自动触发页面的提交功能, 产生刷新页面的行为。
# 解决办法:
# 方法一:
- 取消
form
、el-form
元素,非必要form
,换成div
使用
el-input
的时候,光标聚焦在输入框,按下回车,会刷新页面。这是因为当el-form
表单中只有一个 input 时,按下回车建会自动触发页面的提交功能, 产生刷新页面的行为。
form
、 el-form
元素,非必要 form
,换成 div
@media screen and (max-width: 600px) { | |
/* 当屏幕尺寸小于 600px 时,应用下面的 CSS 样式 */ | |
.class { | |
background: #ccc; | |
} | |
} | |
/* 当屏幕尺寸大于 900px 时,应用下面的 CSS 样式 */ | |
@media screen and (min-width: 900px) { | |
.class { | |
background: #fff; | |
} | |
} |
常用属性:
- name: string,用于自动生成 CSS 过渡类名。例如:name: 'fade' 将自动拓展为 .fade-enter,.fade-enter-active 等。默认类名为 "v"
- appear: boolean,是否在初始渲染时使用过渡。默认为 false。
- css: boolean,是否使用 CSS 过渡类。默认为 true。如果设置为 false,将只通过组件事件触发注册的 JavaScript 钩子。
- type: string,指定过渡事件类型,侦听过渡何时结束。有效值为 "transition" 和 "animation"。默认 Vue.js 将自动检测出持续时间长的为过渡事件类型。
- mode: string,控制离开 / 进入过渡的时间序列。有效的模式有 "out-in" 和 "in-out";默认同时进行。
- duration: number | {enter: number, leave: number} 指定过渡的持续时间。默认情况下,Vue 会等待过渡所在根元素的第一个 transitionend 或 animationend 事件。
自定义过渡类名属性:
- enter-class: string
- leave-class: string
- appear-class: string
- enter-to-class: string
- leave-to-class: string
- appear-to-class: string
- enter-active-class: string
- leave-active-class: string
- appear-active-class: string
transform 属性向元素应用 2D 或 3D 转换。该属性允许我们对元素进行旋转 rotate、扭曲 skew、缩放 scale 和移动 translate 以及矩阵变形 matrix。
语法:
transform: none|transform-functions; | |
/* 即:*/ | |
transform: rotate | scale | skew | translate |matrix; |
<div class="box"> | |
<div class="header">头部</div> | |
<div class="auto-fill">自动填充</div> | |
</div> |
.box { | |
display: flex; | |
flex-flow: column; | |
height: 100%; | |
} | |
.header { | |
background: dodgerblue; | |
height: 30px; | |
} | |
.auto-fill { | |
background: wheat; | |
flex: 1 | |
} |