Vue elementui Table Double-click a cell for editing, focusing, losing focus, showing hidden input and span

Source: Internet
Author: User

<el-table:d ata= "Tabledata"
Class= "Tb-edit"
Style= "width:100%"
ref= "Multipletable"
@selection-change= "Handleselectionchange"
Highlight-current-row
@cell-dblclick= "Dblhandlecurrentchange"
>


Dblhandlecurrentchange (row, column, cell, event) {
Switch (Column.label) {
Case "Longitude (°)":
Row.longitudeflag = true;
Break
Case "Latitude (°)":
Row.dimensionflag = true;
Break
Case "distance (m)":
Row.heightflag = true;
Break
}
},



Focus needs to add the following code in the public JS inside:

Vue.directive (' Focus ', function (el, option) {
var defclass = ' El-input ', Deftag = ' input ';
var value = Option.value | | True
if (typeof value = = = ' Boolean ')
Value = {Cls:defclass, tag:deftag, foc:value};
Else
Value = {Cls:value.cls | | defclass, TAG:VALUE.TAG | | deftag, FOC:VALUE.FOC | | false};
if (El.classList.contains (VALUE.CLS) && VALUE.FOC)
El.getelementsbytagname (Value.tag) [0].focus ();
});


Lost focus Method:
Inputblur (Row, event, column) {
Let tabled = This.tabledata;
Tabled.foreach (function (item) {
Item.longitudeflag = false;
Item.dimensionflag = false;
Item.heightflag = false;
});
},

Vue elementui Table Double-click a cell for editing, focusing, losing focus, showing hidden input and span

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.