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

做饲料推广哪个网站好如何在百度推广自己

做饲料推广哪个网站好,如何在百度推广自己,沈阳建设工程造价,做视频开头的外国网站拖拽功能在平时开发中是很常见的,这篇文章主要使用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.khdw.cn/news/44791.html

相关文章:

  • 新网站做百度推广 收录武汉seo招聘网
  • 红色logo做网站八宿县网站seo优化排名
  • 广州做网站的公司有哪些软文推广500字
  • 医药网站前置审批seo服务外包报价
  • 室内设计效果图的网站家居seo整站优化方案
  • 做的网站出现404郑州网络营销推广
  • win7怎么做网站域名绑定网站维护费用一般多少钱
  • 假发外贸b2c网站怎么做推广专业软文
  • wap html网站模板百度搜索推广优化师工作内容
  • 做淘宝网站目的是什么独立站seo怎么做
  • wordpress免费相册seo关键词排名优化方法
  • 在哪家网站做推广好长沙哪里有网站推广优化
  • 网站路径怎么做百度收录网站提交入口
  • 空间购买网站石家庄今日头条新闻
  • apache 网站建设百度云建站
  • 百度云域名怎么做网站免费正规的接单平台
  • h5应用湖南网络优化
  • 网站设计培训学校找哪家太原网站快速排名提升
  • 网站文化制度建设电销名单渠道在哪里找
  • 合肥中小企业网站制作泉州seo网站排名
  • 口碑好的秦皇岛网站建设价格深圳网络推广哪家比较好
  • 如何把电脑改成服务器做网站百度搜索引擎优化的推广计划
  • 重庆酉阳网站设计公司没干过网络推广能干吗
  • 自己做装修效果的网站上海关键词排名优化公司
  • 动漫网站模板万词优化
  • 专业建站网站服务长春seo外包
  • 智能网站价格郑州网站排名推广
  • wordpress插件汉化下载地址台州seo排名优化
  • 法库网站建设百度推广是什么工作
  • 如何用VS2017做网站教育培训网站设计