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

网站框架图怎么做百度app推广方法

网站框架图怎么做,百度app推广方法,外卖网站怎么做,wordpress的搭建环境拖拽功能在平时开发中是很常见的,这篇文章主要使用react-beautiful-dnd插件实现此功能。 非常好用,附上GitHub地址:https://github.com/atlassian/react-beautiful-dnd 安装及引入 // 1.引入 # yarn yarn add react-beautiful-dnd# npm npm…

拖拽功能在平时开发中是很常见的,这篇文章主要使用react-beautiful-dnd插件实现此功能。
非常好用,附上GitHub地址:https://github.com/atlassian/react-beautiful-dnd


安装及引入

// 1.引入
# yarn
yarn add react-beautiful-dnd# npm
npm install react-beautiful-dnd --save

具体使用
 

import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";// 样式相关 代码
const grid = 8;
// 垂直样式
// const getItemStyle = (isDragging, draggableStyle) => ({
//     // some basic styles to make the items look a bit nicer
//     userSelect: "none",
//     padding: grid * 2,
//     margin: `0 0 ${grid}px 0`,
//
//     // change background colour if dragging
//     background: isDragging ? "lightgreen" : "grey",
//
//     // styles we need to apply on draggables
//     ...draggableStyle
// });
// const getListStyle = isDraggingOver => ({
//     background: isDraggingOver ? "lightblue" : "lightgrey",
//     padding: grid,
//     width: 250,
// });// 水平样式
const getItemStyle = (isDragging, draggableStyle) => ({// some basic styles to make the items look a bit niceruserSelect: 'none',padding: grid * 2,margin: `0 ${grid}px 0 0`,// change background colour if draggingbackground: isDragging ? 'lightgreen' : 'grey',// styles we need to apply on draggables...draggableStyle,
});
const getListStyle = isDraggingOver => ({background: isDraggingOver ? 'lightblue' : 'lightgrey',display: 'flex',padding: grid,overflow: 'auto',
});class App extends React.Component {constructor(props) {super(props)this.state = {items: [{id: 'item-0', content: 'hello'},{id: 'item-1', content: 'I'},{id: 'item-2', content: 'am'},{id: 'item-3', content: '卡'},{id: 'item-4', content: '特'},{id: 'item-5', content: '洛'},]};}// a little function to help us with reordering the resultreOrder = (list, startIndex, endIndex) => {const result = Array.from(list);const [removed] = result.splice(startIndex, 1);result.splice(endIndex, 0, removed);return result;};onDragEnd = (result) => {// dropped outside the listif (!result.destination) {return;}const items = this.reOrder(this.state.items,result.source.index,result.destination.index);this.setState({items});}render () {return (<div className="App"><DragDropContext onDragEnd={this.onDragEnd}><Droppable droppableId="droppable" direction="horizontal">{(provided, snapshot) => (<divref={provided.innerRef}style={getListStyle(snapshot.isDraggingOver)}{...provided.droppableProps}>{this.state.items.map((item, index) => (<Draggable key={item.id} draggableId={item.id} index={index}>{(provided, snapshot) => (<divref={provided.innerRef}{...provided.draggableProps}{...provided.dragHandleProps}style={getItemStyle(snapshot.isDragging,provided.draggableProps.style)}>{item.content}</div>)}</Draggable>))}{provided.placeholder}</div>)}</Droppable></DragDropContext></div>);}
}export default App;

说明一下:<Droppable />中的 direction 属性可以控制是水平方向还是垂直方向,配合相关 getItemStyle 和 getListStyle 的代码,可做到。
效果展示

补充一下: 如果你是react-creat-app 创建的项目,则需要删除代码里自带的react 严格模式。否则拖拽效果出不来。

http://www.mmbaike.com/news/49730.html

相关文章:

  • wordpress laravel速度网络优化排名培训
  • 网站建设gongsi国内新闻摘抄2022年
  • 专业建站源码app软件开发制作公司
  • 网站做统计分析电商运营怎么做如何从零开始
  • 沈阳网站建设公司哪家好广州网络推广公司有哪些
  • 做网站要注册商标第几类百度竞价广告的位置
  • 教育做的比较好的网站有哪些steam交易链接在哪看
  • 潍坊网站建设招商宁波网站优化
  • 做传奇私服网站关键词优化推广
  • 网站建设图片尺寸要求网页模板之家
  • magento vs wordpressseo站长工具查询
  • 帮推广平台北京seo专业团队
  • 网站还难做啊推广网络公司
  • 方林装饰400客服电话湖南企业竞价优化首选
  • 营销型网站要点头条搜索
  • 企业网站改版的意义外贸自建站的推广方式
  • 免费推广网站方法大集合广州推广排名
  • 在手机上怎么赚钱镇江seo
  • 设计一个网站报价长沙seo关键词排名
  • .net.cn做网站怎么样谷歌关键词排名查询
  • 公司做网站怎么收费潍坊网站建设方案咨询
  • 怎么增加网站的权重合肥seo推广培训班
  • 专业性网站做线上运营优化大师软件大全
  • 兰州网站推广优化今日头条新闻推荐
  • 网站做链接算侵权吗潍坊关键词优化排名
  • wordpress菜鸟网奇seo赚钱培训
  • wordpress 子目录建站整站seo教程
  • 一般建设网站的常见问题百度app交易平台
  • 网址大全hao123seo培训网的优点是
  • 网站怎样做wap端个人网页制作完整教程