JavaScript/vue.js/element-ui:修订间差异
来自康健生活
< JavaScript | vue.js
| (未显示同一用户的1个中间版本) | |||
| 第14行: | 第14行: | ||
实现一 | 实现一 | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
import Vue from "vue" | |||
import {Input} from "element-ui" | |||
... | |||
methods: { | |||
putComment (event){ | |||
let CommentTextarea = Vue.extend(Input) | |||
let showCommentTextarea = new CommentTextarea({ | |||
propsData:{ | |||
type:"textarea" | |||
} | |||
}).$mount() | |||
event.target.parentNode.parentNode.parentNode.insertBefore(showCommentTextarea.$el, null); | |||
}, | |||
</syntaxhighlight> | |||
== css == | |||
深度修改标签样式 | |||
<syntaxhighlight lang="css"> | |||
/deep/ .el-button { | |||
width: 100%; | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
2022年8月23日 (二) 08:11的最新版本
引言
实现
监听Element组件<el-input>标签的回车事件
<el-input
v-model="searchValue"
class="header-search__module"
type="text"
@keyup.enter.native="handleSearch"
:input="inputValueChange"
:placeholder="placeholderSearchValue">
</el-input>
动态插入 El 标签
实现一
import Vue from "vue"
import {Input} from "element-ui"
...
methods: {
putComment (event){
let CommentTextarea = Vue.extend(Input)
let showCommentTextarea = new CommentTextarea({
propsData:{
type:"textarea"
}
}).$mount()
event.target.parentNode.parentNode.parentNode.insertBefore(showCommentTextarea.$el, null);
},
css
深度修改标签样式
/deep/ .el-button {
width: 100%;
}
No categories