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

珠海网站建设厚瑜官网排名优化方案

珠海网站建设厚瑜,官网排名优化方案,商务网站价格,首码项目网简述 作为一名前端开发人员,在工作中难免会遇到拖拽功能,分享一个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.yidumall.com/news/38998.html

相关文章:

  • 福建省建设厅网站 登录广州网站运营
  • 网站被黑应该怎么做企业网站优化技巧
  • 南京网站设南京网站设计计百度获客
  • 做外贸网站用什么空间网络营销策略都有哪些
  • 怎么快速做网站搜索关键词排名
  • 微信公众号登录wordpress网站seo线上培训多少钱
  • 网站建设维护一年费用网络营销竞价推广
  • 电子商务网站建设作文网络营销方法有几种类型
  • 平面设计师必看的网站网络软文广告
  • 100tab武汉网站建设唐山seo排名外包
  • 一个网站2级域名多国际购物网站平台有哪些
  • 企业网站创建的步骤线上推广的渠道和方法
  • 武汉十大跨境电商公司优化搜索引擎
  • 厦门海沧网站建设百度官网网站登录
  • 自己做效果图的网站朋友圈软文范例
  • 重庆企业网站建设报价seo搜索引擎实战详解
  • 大连网站流量优最新足球消息
  • 做网站的法律长沙推广公司
  • 做企业营销网站外包
  • 同仁微网站建设工作室友情链接交换形式有哪些
  • 家教网站开发东莞seo排名外包
  • 常见的网站空间新站优化案例
  • 高中毕业学网站开发重要新闻
  • 做网站游戏需要什么推广计划书范文
  • 网站美国1g内存独立空间seo薪资seo
  • 建材做网销哪个网站好百度推广排名怎么做的
  • 客服网站怎么做营销软件有哪些
  • 手机版网站快照如何做网络营销的缺点及建议
  • 如何建设简单小型网站厦门网
  • 做电影网站怎么赚钱2345网址大全设主页