File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 </ tr >
4444 </ thead >
4545 < tbody >
46- < tr v-for ="(column, index) in columns ">
46+ < tr ref =" columns " v-for ="(column, index) in columns " draggable =" true " @dragend =" dragEnd " @dragover =" dragOver ">
4747 < td >
4848 < input v-model ="column.name " type ="text " />
4949 </ td >
8686 < option value ="geometry "> Geometry</ option >
8787 < option value ="geometrycollection "> Geometry Collection</ option >
8888 < option value ="json "> JSON</ option >
89- < option value ="point "> point </ option >
89+ < option value ="point "> Point </ option >
9090 < option value ="multipoint "> Multiple Point</ option >
9191 < option value ="polygon "> Polygon</ option >
9292 < option value ="multipolygon "> Multiple Polygon</ option >
116116 data ( ) {
117117 return {
118118 columns : [ ] ,
119+ row : null ,
119120 }
120121 } ,
121122 mounted ( ) {
140141 remove ( index ) {
141142 this . columns . splice ( index , 1 )
142143 } ,
144+ dragEnd ( event ) {
145+ let rows = this . $refs . columns
146+ let newIndex = rows . indexOf ( this . row )
147+ let prevIndex = rows . indexOf ( event . currentTarget )
148+
149+ let currentColumn = this . columns . splice ( prevIndex , 1 )
150+ this . columns . splice ( newIndex , 0 , currentColumn [ 0 ] )
151+ } ,
152+ dragOver ( event ) {
153+ this . row = event . currentTarget
154+ }
143155 } ,
144156 } ) . mount ( "article" )
145157</ script >
You can’t perform that action at this time.
0 commit comments