执行过npm install命令的vue-element-admin源码
康凯
2022-05-20 aa4c235a8ca67ea8b731f90c951a465e92c0a865
1
{"remainingRequest":"D:\\源码\\vue-element-admin-master\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\源码\\vue-element-admin-master\\src\\views\\table\\drag-table.vue?vue&type=style&index=0&lang=css&","dependencies":[{"path":"D:\\源码\\vue-element-admin-master\\src\\views\\table\\drag-table.vue","mtime":1649647926000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\css-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\postcss-loader\\src\\index.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCi5zb3J0YWJsZS1naG9zdHsKICBvcGFjaXR5OiAuODsKICBjb2xvcjogI2ZmZiFpbXBvcnRhbnQ7CiAgYmFja2dyb3VuZDogIzQyYjk4MyFpbXBvcnRhbnQ7Cn0K"},{"version":3,"sources":["drag-table.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqIA;AACA;AACA;AACA;AACA","file":"drag-table.vue","sourceRoot":"src/views/table","sourcesContent":["<template>\n  <div class=\"app-container\">\n    <!-- Note that row-key is necessary to get a correct row order. -->\n    <el-table ref=\"dragTable\" v-loading=\"listLoading\" :data=\"list\" row-key=\"id\" border fit highlight-current-row style=\"width: 100%\">\n      <el-table-column align=\"center\" label=\"ID\" width=\"65\">\n        <template slot-scope=\"{row}\">\n          <span>{{ row.id }}</span>\n        </template>\n      </el-table-column>\n\n      <el-table-column width=\"180px\" align=\"center\" label=\"Date\">\n        <template slot-scope=\"{row}\">\n          <span>{{ row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>\n        </template>\n      </el-table-column>\n\n      <el-table-column min-width=\"300px\" label=\"Title\">\n        <template slot-scope=\"{row}\">\n          <span>{{ row.title }}</span>\n        </template>\n      </el-table-column>\n\n      <el-table-column width=\"110px\" align=\"center\" label=\"Author\">\n        <template slot-scope=\"{row}\">\n          <span>{{ row.author }}</span>\n        </template>\n      </el-table-column>\n\n      <el-table-column width=\"100px\" label=\"Importance\">\n        <template slot-scope=\"{row}\">\n          <svg-icon v-for=\"n in + row.importance\" :key=\"n\" icon-class=\"star\" class=\"icon-star\" />\n        </template>\n      </el-table-column>\n\n      <el-table-column align=\"center\" label=\"Readings\" width=\"95\">\n        <template slot-scope=\"{row}\">\n          <span>{{ row.pageviews }}</span>\n        </template>\n      </el-table-column>\n\n      <el-table-column class-name=\"status-col\" label=\"Status\" width=\"110\">\n        <template slot-scope=\"{row}\">\n          <el-tag :type=\"row.status | statusFilter\">\n            {{ row.status }}\n          </el-tag>\n        </template>\n      </el-table-column>\n\n      <el-table-column align=\"center\" label=\"Drag\" width=\"80\">\n        <template slot-scope=\"{}\">\n          <svg-icon class=\"drag-handler\" icon-class=\"drag\" />\n        </template>\n      </el-table-column>\n    </el-table>\n    <div class=\"show-d\">\n      <el-tag>The default order :</el-tag> {{ oldList }}\n    </div>\n    <div class=\"show-d\">\n      <el-tag>The after dragging order :</el-tag> {{ newList }}\n    </div>\n  </div>\n</template>\n\n<script>\nimport { fetchList } from '@/api/article'\nimport Sortable from 'sortablejs'\n\nexport default {\n  name: 'DragTable',\n  filters: {\n    statusFilter(status) {\n      const statusMap = {\n        published: 'success',\n        draft: 'info',\n        deleted: 'danger'\n      }\n      return statusMap[status]\n    }\n  },\n  data() {\n    return {\n      list: null,\n      total: null,\n      listLoading: true,\n      listQuery: {\n        page: 1,\n        limit: 10\n      },\n      sortable: null,\n      oldList: [],\n      newList: []\n    }\n  },\n  created() {\n    this.getList()\n  },\n  methods: {\n    async getList() {\n      this.listLoading = true\n      const { data } = await fetchList(this.listQuery)\n      this.list = data.items\n      this.total = data.total\n      this.listLoading = false\n      this.oldList = this.list.map(v => v.id)\n      this.newList = this.oldList.slice()\n      this.$nextTick(() => {\n        this.setSort()\n      })\n    },\n    setSort() {\n      const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]\n      this.sortable = Sortable.create(el, {\n        ghostClass: 'sortable-ghost', // Class name for the drop placeholder,\n        setData: function(dataTransfer) {\n          // to avoid Firefox bug\n          // Detail see : https://github.com/RubaXa/Sortable/issues/1012\n          dataTransfer.setData('Text', '')\n        },\n        onEnd: evt => {\n          const targetRow = this.list.splice(evt.oldIndex, 1)[0]\n          this.list.splice(evt.newIndex, 0, targetRow)\n\n          // for show the changes, you can delete in you code\n          const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]\n          this.newList.splice(evt.newIndex, 0, tempIndex)\n        }\n      })\n    }\n  }\n}\n</script>\n\n<style>\n.sortable-ghost{\n  opacity: .8;\n  color: #fff!important;\n  background: #42b983!important;\n}\n</style>\n\n<style scoped>\n.icon-star{\n  margin-right:2px;\n}\n.drag-handler{\n  width: 20px;\n  height: 20px;\n  cursor: pointer;\n}\n.show-d{\n  margin-top: 15px;\n}\n</style>\n"]}]}