添加表格拖动

This commit is contained in:
jmal 2020-03-02 18:03:22 +08:00
parent 7851002acf
commit 2c64253c90
2 changed files with 108 additions and 95 deletions

View File

@ -35,6 +35,7 @@
"vue-simple-uploader": "^0.7.4", "vue-simple-uploader": "^0.7.4",
"vue-touch": "^2.0.0-beta.4", "vue-touch": "^2.0.0-beta.4",
"vue-wechat-title": "^2.0.5", "vue-wechat-title": "^2.0.5",
"vuedraggable": "^2.23.2",
"vuex": "3.1.0", "vuex": "3.1.0",
"we-vue": "^2.3.3", "we-vue": "^2.3.3",
"webuploader": "^0.1.8", "webuploader": "^0.1.8",

View File

@ -250,10 +250,11 @@ import Bus from '@/assets/js/bus'
import api from '@/api/upload-api' import api from '@/api/upload-api'
import BreadcrumbFilePath from "../../components/Breadcrumb/BreadcrumbFilePath"; import BreadcrumbFilePath from "../../components/Breadcrumb/BreadcrumbFilePath";
import IconFile from "../../components/Icon/IconFile"; import IconFile from "../../components/Icon/IconFile";
// import Sortable from 'sortablejs' import vuedraggable from 'vuedraggable';
import Sortable from 'sortablejs'
export default { export default {
components: {IconFile, BreadcrumbFilePath}, components: { IconFile, BreadcrumbFilePath, vuedraggable},
data() { data() {
return { return {
imageUrl: process.env.VUE_APP_BASE_API + '/view/thumbnail?jmal-token=' + this.$store.state.user.token + '&id=', imageUrl: process.env.VUE_APP_BASE_API + '/view/thumbnail?jmal-token=' + this.$store.state.user.token + '&id=',
@ -400,16 +401,23 @@ export default {
} }
}, },
methods: { methods: {
draggableChange(){
console.log(678)
},
// 行拖拽 // 行拖拽
rowDrop() { rowDrop() {
// const tbody = document.querySelector('.el-table__body-wrapper tbody') const tbody = document.querySelector('.el-table__body-wrapper tbody')
// const _this = this const _this = this
// Sortable.create(tbody, { Sortable.create(tbody, {
swap: true,
chosenClass: 'sortable-highlight',
animation: 150,
sort: false
// onMoveCallback({ newIndex, oldIndex }) { // onMoveCallback({ newIndex, oldIndex }) {
// const currRow = _this.fileList.splice(oldIndex, 1)[0] // const currRow = _this.fileList.splice(oldIndex, 1)[0]
// _this.fileList.splice(newIndex, 0, currRow) // _this.fileList.splice(newIndex, 0, currRow)
// } // }
// }) })
}, },
// 格式化最近时间 // 格式化最近时间
formatTime(time) { formatTime(time) {
@ -1469,5 +1477,9 @@ export default {
overflow: auto; overflow: auto;
} }
/deep/ .sortable-highlight {
background-color: #66cc66;
}
</style> </style>