< hr >
as shown in the figure, I want to use element-ui to achieve a function of editing in such a table, please give me a train of thought, thank you!
< hr >
as shown in the figure, I want to use element-ui to achieve a function of editing in such a table, please give me a train of thought, thank you!
double-click the cell to edit
Preview: https://jsfiddle.net/bgfxv3eu/
el-table-column do not want to prop. Write
< template slot-scope= "props" >
< / template >
and then get the contents of the table through scope.row.XXX.
write a v-show of span and input on the contrary. When you click to edit, let show reverse ok.
is roughly
<el-table-column label="">
<template slot-scope="scope">
<div class="content-rowspan">
<div v-for="(list,index) in scope.row.lists">
<p v-show="scope.row.show">
{{list}}
<el-button class="delelist" type="danger" size="small" @click="delelist(tableData1,scope.$index,index)"></el-button>
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-show="!scope.row.show" v-model="scope.row.lists[index]"></el-input>
</div>
<div><el-button size="small" type="primary" icon="plus" @click="addlist(tableData1,scope.$index)"></el-button></div>
</div>
</template>
</el-table-column>
the lower version is scope= "scope"
gives you an idea, and you can see if you can understand:
1. Put one in each column that needs to be clicked to be editable, which is equal to the width and height of that column. And the style is the same input
input box
2, use v-if
and v-else
to control input and span (I imagine binding content and display as contained in span)
3, let v-model
and span binding values
of input
are the same
, and then define a variable to control the show-hidden switch of input and span. The content displayed at this time is
consistent with the content bound by span, so the changes will take effect in real time without event control
5. When input
loses focus or the user presses the enter
key, input > hides
span > shows
ideas, but I make it a component, and the parameters of v-show change according to the data model in my component. This will not cause the line you say to become an input box. The main reason is that if there are too many input boxes, it is too troublesome to configure visible parameters separately
I'll give you an ultra-simple idea. Vue has a magic component called < component > dynamic component
< component: is= "type" > < / component >
type = TableText or TableInput
it's up to you
my idea is about the same as upstairs. Put an input, in each cell and click show, to edit enter hide
.but you can also try the contenteditable of ide/HTML/Content_Editable-sharp%E6%A6%82%E8%BF%B0" rel=" nofollow noreferrer "> h5
.just can t show it. Thank you very much for your advice. ...
< H2 > now there is a strange situation, that is, when I use the Loadmore component, the pull-up load is not performed, only the drop-down refresh is performed. It only executes every time I change the location of the component, but after I refresh it, i...
like this [array [xxx], array [xxx], array [xxx].] merge all xxx in array into one array [xxx.] ...
1. Scrolling loading cannot be achieved with vue-waterfall,. The first screen displays normally. Scrolling to the bottom does not send ajax, and how to modify the current page 2. The code is as follows: script created ...
message is an empty object, var app = new Vue({ el: -sharpapp , data: { message: {}, }, and then in <input ... v-model="message.foo"> <input ... v-model="message.foo.bar"> how do ...
http: www.qqbsmall.com data .; > http: www.qqbsmall.com data .; > http: www.qqbsmall.com data .; > http: www.qqbsmall.com data .; > http: www.qqbsmall.com data .; > http: www.qqbsmall.com data .; > http: www.qqbsmall.com data ....
for projects created with vue-cli, the default webpack configuration is packaged into a single file. Now there is a need to package out many folders. The corresponding html,js and css in different folders have modified some configurations to be in the f...
I introduced another A.vue page in a B.vue page. Now click the method in A to adjust the method in B (with a form) this is the form < el-form: model= "dialogForm.data " > of A. <el-row> <el-input type="hidden" v-mode...
enter a newline character in the reverse apostrophe, which is output as is. How to make the newline character work ...
the resLoader plug-in causes the ios9 browser web page to go blank vue project ...
Vue the first button clicks to jump out of the countdown, and the second button clicks to jump out of the fixed data, but the data that pops out suddenly jumps back to the automatic countdown var app = new Vue ({ el: -sharpapp , data:{ ite...
each time nuxt uses keep-alive, to switch pages, it will empty the data in data, which is inconsistent with the performance of keep-alive in normal vue-cli-built projects. for example, the asynchronously acquired data I loaded in list is switched to i...
The problem with is that I have a vue plug-in (which uses vue install exports and can use plug-ins introduced by vue.use ()), and I want to use vuex to communicate between components in this plug-in. currently there are the following problems: what I...
whether a vue project can set the root domain name of the provider by reading web.config or config.json after packaging. in this way, even if the root domain name is redeployed in the background, the front end of the root domain name does not have to be...
now my project is to package css and js separately, and the directory structure after packaging is the same as before. before packing: csscssimages.. csscss.. .. : webpack.config.js csscss csscss I would like to ask all the great gods, what ...
when submitting the form, I have been reporting 415 errors and tried many ways. My own is not good, nor is my copy colleague s, but my colleague s will not report an error, exactly the same way. I don t know why. html have you ever encountered th...
upload financial bills. The front end parses nearly 300000 data when uploading files. When you click the upload button, you need to send these 300000 pieces of data to the backend. now you will report Message length exceeded maximum allowed length. w...
there is a mobile project currently in testing, using vue (2.2.2) + mint-ui for development, and I don t know how to handle compatibility. What method should be used to determine whether the current environment is working properly? I just looked at t...
nuxt 1.4 uses keepAlive, in nuxt, but I find that when the page component is switched, the data in data will be reset and emptied when entering the interface . Is this his bug? if there is a problem with the setting, how can I modify the setting? ...
use vue to do a nine-grid lucky draw, which is fast at the beginning, slow down after a few laps, and can control where to stop. There is a big lucky draw button in the middle of the prize. How to write the style, ask for advice ...