From cceed30d352e0499b84177f2425366bc6cbdfaae Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Mon, 19 Oct 2020 09:16:45 +0200 Subject: [PATCH] =?UTF-8?q?IPTV=E6=8B=96=E6=9B=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/IPTV.vue | 48 +++++++++++++---------------------------- src/components/Star.vue | 4 ++-- 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/src/components/IPTV.vue b/src/components/IPTV.vue index 00e7176..8573878 100644 --- a/src/components/IPTV.vue +++ b/src/components/IPTV.vue @@ -40,6 +40,7 @@ import { iptv, iptvSearch } from '../lib/dexie' import { iptv as defaultSites } from '../lib/dexie/initData' import { remote } from 'electron' import fs from 'fs' +import Sortable from 'sortablejs' export default { name: 'iptv', data () { @@ -228,44 +229,25 @@ export default { ele.id = id id += 1 }) + }, + rowDrop () { + const tbody = document.getElementById('iptv-table').querySelector('.el-table__body-wrapper tbody') + const _this = this + Sortable.create(tbody, { + onEnd ({ newIndex, oldIndex }) { + const currRow = _this.iptvList.splice(oldIndex, 1)[0] + _this.iptvList.splice(newIndex, 0, currRow) + _this.updateDatabase(_this.iptvList) + } + }) } }, + mounted () { + this.rowDrop() + }, created () { this.getSites() this.getSearchList() } } - diff --git a/src/components/Star.vue b/src/components/Star.vue index f9f8387..7613a82 100644 --- a/src/components/Star.vue +++ b/src/components/Star.vue @@ -7,7 +7,7 @@ 清空 同步所有收藏 -
+