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

150网站建设seo咨询顾问

150网站建设,seo咨询顾问,电脑做apk的网站h5,三水住房和城乡建设局的网站简述 作为一名前端开发人员,在工作中难免会遇到拖拽功能,分享一个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.wangmingla.cn/news/26038.html

相关文章:

  • 网站建设论文设计百度广告怎么投放多少钱
  • 给别人做违法网站竞价推广托管服务
  • 罗湖做网站联系电话怎么在百度上推广自己的店铺
  • 有什么发布做投标报价的网站新网站seo
  • 大学生网页设计大赛作品排名轻松seo 网站推广
  • 360网站地图怎么做seo如何优化网站
  • 郑州网站seo优化seo公司上海
  • 通用网站后台管理 asp.net 源码网站排名优化查询
  • 在深圳做it的要做赌博网站吗济南网站建设公司
  • sharepoint做门户网站百度知道app官方下载
  • 哪个网站可以改字体免费推广app软件下载
  • 日本网站服务器自己如何注册一个网站
  • 个人怎么做音乐网站seo店铺描述例子
  • 地方网站做相亲赢利点在哪里seo免费外链工具
  • 还有那个网站可以做兼职呢网站建设合同模板
  • wordpress列表分页代码哈尔滨seo优化软件
  • 泰安整站优化北京网站优化快速排名
  • 做试管的网站网络广告推广公司
  • 新开传奇网站迷失版sem是什么
  • 做建网站的工作一年赚几百万系统优化是什么意思
  • 上海网站建设公司哪家好?电商营销推广方法
  • 商城类网站东莞优化排名公司
  • 四川省住房和城乡建设厅官网站网成都seo推广员
  • wordpress压缩数据库深圳seo优化排名推广
  • 深圳做商城网站网上推广
  • 网站系统是一个典型的搜索引擎推广渠道
  • 如何修改网站ico郑州网站建设公司哪家好
  • txt做网站 插入图片电商运营转行后悔了
  • 简述常用的软件开发文档网站搜索关键词优化
  • 网站建设都有什么功能站长之家域名查询官网