vue 插件收藏

vue tytrock ⋅ 于 2020-04-21 11:03:45 ⋅ 2059 阅读

1、省市区选择V - Distpicker

npm install v-distpicker --save

官网:https://distpicker.pigjian.com/


2、拖拽组件

npm install vue-slicksort --save

github:https://github.com/Jexordexan/vue-slicksort

Demo:https://jexordexan.github.io/vue-slicksort


3、创建思维导图

npm install bi-vue-mindmap --save

image.png

https://www.npmjs.com/package/bi-vue-mindmap?activeTab=readme



4、页面转图片

npm install html2canvas --save

http://html2canvas.hertzen.com/getting-started


5、el-table表格拖拽

安装组件

npm install vuedraggable;
npm install sortablejs;

使用

import Sortable from 'sortablejs'
mounted(){
    this.$nextTick(() => {
	this.drag();
    });
},
methods:{
    drag() {
      const el = document.querySelectorAll(
        ".el-table__body-wrapper > table > tbody"
      )[0];
      Sortable.create(el, {
      	forceFallback: true,
        disabled: false, // 拖拽不可用? false 启用
        //ghostClass: 'sortable-ghost', //拖拽样式
        dragClass: 'sortable-ghost',//拖放时的DOM节点的class名称,可在此class下定义相应的样式
        animation: 150, // 拖拽延时,效果更好看
        onEnd: (e) => { // 拖拽结束时的触发
        	console.log(e)
        	
        },
      });
    },
}

CSS(处理拖拽时背景透明不美观)

::v-deep .sortable-ghost {
	background-color: #fff !important;
	opacity: 1 !important;
	z-index: 99999;
	width: 100%;
	td{
		background-color: #fff !important;
		border:1px solid #dfe6ec;
	}
}

相关参数


group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] }

sort: true, //在列表内支持排序。 sorting inside list 

delay: 0, // 时间以毫秒为单位来定义排序应该何时开始。 time in milliseconds to define when the sorting should start

touchStartThreshold: 0, // 像素,在多少像素移动范围内课取消延迟拖动事件。 px, how many pixels the point should move before cancelling a delayed drag event

disabled: false, // 如果设置为true,则禁用排序。 Disables the sortable if set to true.

store: null, // @see Store

animation: 150, // 毫秒,排序时移动物品的动画速度,`0`则表示无动画。 ms, animation speed moving items when sorting, `0` — without animation

handle: ".my-handle", // 列表项中拖动手柄选择,可以设置列表中item中的某个DOM节点为拖动的依据。 Drag handle selector within list items

filter: ".ignore-elements", // 选择不支持拖动的选择器(String或Function)。 Selectors that do not lead to dragging (String or Function)

preventOnFilter: true, // 触发`filter`时调用`event.preventDefault()`。 Call `event.preventDefault()` when triggered `filter`

draggable: ".item", // 指定元素中的哪些项应该是可拖动的。 Specifies which items inside the element should be draggable

ghostClass: "sortable-ghost", // 拖放时,提前预设DOM节点的class名称,可在此class下定义相应的样式。 Class name for the drop placeholder

chosenClass: "sortable-chosen", // 选中时的DOM节点的class名称,可在此class下定义相应的样式。Class name for the chosen item

dragClass: "sortable-drag", // 拖放时的DOM节点的class名称,可在此class下定义相应的样式。Class name for the dragging item

dataIdAttr: 'data-id',

forceFallback: false, // 忽略HTML5 DnD行为并强制回退使用。ignore the HTML5 DnD behaviour and force the fallback to kick in

fallbackClass: "sortable-fallback", //使用forceFallback时的克隆DOM元素的类名。 Class name for the cloned DOM Element when using forceFallback

fallbackOnBody: false, // 将克隆的DOM元素追加到Document中Body 。Appends the cloned DOM Element into the Document's Body

fallbackTolerance: 0, // 以像素为单位指定鼠标在被视为拖动之前应移动多远。Specify in pixels how far the mouse should move before it's considered as a drag.

scroll: true, // or HTMLElement

scrollFn: function(offsetX, offsetY, originalEvent, touchEvt, hoverTargetEl) { ... }, // 如果你有自定义滚动条scrollFn可用于自动滚动 。if you have custom scrollbar scrollFn may be used for autos



回复数量: 0
    暂无评论~~
    • 请注意单词拼写,以及中英文排版,参考此页
    • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`, 更多语法请见这里 Markdown 语法
    • 支持表情,使用方法请见 Emoji 自动补全来咯,可用的 Emoji 请见 :metal: :point_right: Emoji 列表 :star: :sparkles:
    • 上传图片, 支持拖拽和剪切板黏贴上传, 格式限制 - jpg, png, gif
    • 发布框支持本地存储功能,会在内容变更时保存,「提交」按钮点击时清空
    Ctrl+Enter