当前位置: 首页 > news >正文

150网站建设百度注册新账号

150网站建设,百度注册新账号,重庆网站快速排名提升,顺义网站优化简述 作为一名前端开发人员,在工作中难免会遇到拖拽功能,分享一个github上一个不错的拖拽js库,能满足我们在项目开发中的需要,支持Vue和React,下面是SortableJS的使用详细; 这个是sortableJS中文官方文档&…

简述

作为一名前端开发人员,在工作中难免会遇到拖拽功能,分享一个github上一个不错的拖拽js库,能满足我们在项目开发中的需要,支持VueReact,下面是SortableJS的使用详细;

 

这个是sortableJS中文官方文档,记录了一些相关属性和使用方法,页面十分简约方便阅读;

SortableJs中文文档http://www.sortablejs.com

下面是使用详细,主要分为3步;

1、首相需要安装相关依赖:npm install sortablejs --save;

2、页面引入使用:import Sortable from "sortablejs";

3、获取大盒子属性,然后在初始化的使用需要调用Sortable.create()方法;

 

vue页面使用;

<template><div class="sortable"><div id="container" ref="sortableBox"><div v-for="(item, index) in arr" :key="item"><span>{{ item }}</span></div></div></div>
</template><script>
import Sortable from "sortablejs";
export default {name: "CodeDemoSortable",data() {return {arr: ["one", "two", "three", "four"],};},mounted() {this.defineSortable();},methods: {defineSortable() {this.$nextTick(() => {const el = this.$refs.sortableBox;// 或则使用// const el = document.getElementById("container");Sortable.create(el, {animation: 200,//拖拽动画过渡时间group: "name",sort: true,});});},},
};
</script><style lang="scss" scoped>
.sortable {#container {width: 600px;height: 300px;margin: 50px auto;background-color: skyblue;padding: 20px;box-sizing: border-box;display: flex;flex-direction: column;justify-content: space-around;div {height: 20%;text-align: center;line-height: 50px;width: 100%;background-color: plum;}}
}
</style>

 

html页面使用;

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.container {width: 600px;height: 300px;margin: 50px auto;background-color: skyblue;padding: 20px;box-sizing: border-box;display: flex;flex-direction: column;justify-content: space-around;}.container>div {height: 20%;text-align: center;line-height: 52px;width: 100%;background-color: plum;}</style>
</head><body><div class="container"><div>one</div><div>two</div><div>three</div></div><!-- 引入js文件,也可以把js文件下载到本地使用 --><script src="https://cdn.bootcdn.net/ajax/libs/Sortable/1.15.0/Sortable.min.js"></script><script>const el = document.querySelector('.container')// 初始化var sortable = Sortable.create(el, {animation: 200,//拖拽动画过渡时间group: "name",sort: true});</script>
</body></html>

 

效果图如下:

2fff1f879b4e40cba11b027ff70a8807.gif

 

感觉有用,就一键三连,感谢(●'◡'●)

 

http://www.dinnco.com/news/36634.html

相关文章:

  • 济南手机网站建设公司天津seo排名扣费
  • 农业网站建设模板下载百度网址导航
  • 营销型网站建设方案百度搜索风云榜单
  • 网站服务器停止响应怎么办蚌埠网络推广
  • wordpress 注册 插件seo整站优化报价
  • 网站建设wix个人如何加入百度推广
  • 曲阜做网站销售外包公司
  • wordpress apply filters电脑突然多了windows优化大师
  • 心道教学网门户seo教程培训班
  • 企业网站建设的层次seo研究中心培训机构
  • 建立网站的用处百度提交网站收录查询
  • 工商注册服务平台宁波seo网络推广渠道介绍
  • 想把比尔的网站封了如何做找培训机构的网站
  • wordpress语言文件编辑器seo的推广技巧
  • 品牌画册设计宝鸡seo优化公司
  • a4网站建设郑州seo课程
  • 手机上怎么建网站竞价点击软件工具
  • 新增备案 网站名字百度指数爬虫
  • 徐州人才招聘网官网抖音seo教程
  • 网站建设大概要多少钱自己个人怎样做电商
  • 重庆建网站营销图片素材
  • 做新闻微网站有哪些竞价托管哪家公司好
  • wordpress多说seo诊断站长
  • 惠州企业网站建设选哪家市场调研的重要性
  • 有哪些教育网站做的比较好百度超级链
  • 湖南做网站 在线磐石网络官网seo哪家公司好
  • 网站建设原因分析最新新闻热点事件摘抄
  • 最好的免费logo设计网站91关键词
  • 做外贸的阿里巴巴网站是哪个推广网站有哪些
  • 自己有了域名 怎么做网站sns营销