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

香河住房和城乡建设局网站wordpress mediaelement.js

香河住房和城乡建设局网站,wordpress mediaelement.js,wordpress搜索图标,平面设计公司职位省市区三级联动选择是个很频繁的需求#xff0c;但是查看了市面上很多插件不是太老不维护就是不满足需求#xff0c;就试着实现一个 这个功能无任何依赖插件 功能略简单#xff0c;但能实现需求 核心代码也尽力控制在了60行左右 pca-code.json树型数据来源 Administrative-d… 省市区三级联动选择是个很频繁的需求但是查看了市面上很多插件不是太老不维护就是不满足需求就试着实现一个 这个功能无任何依赖插件 功能略简单但能实现需求 核心代码也尽力控制在了60行左右 pca-code.json树型数据来源 Administrative-divisions-of-China 下面只贴了省市区选择的功能全部代码可参考github area分支 import { useState, useEffect } from react import { View, StyleSheet, FlatList, Text, TouchableOpacity } from react-native import pcaCode from ../assets/pca-code.jsonexport default () {const [selected, setSelected] useState([]) //选择过的省市区const [options, setOptions] useState([pcaCode]) //每一级的数据const [level, setLevel] useState(0) // 当前展示第几级useEffect(() {console.log(selected)}, [selected])const renderItem ({ item }) (TouchableOpacity style{styles.option} onPress{() activeItem(item)}Text style{[styles.option_text, isActive(item.code) styles.option_text_active]}{item.name}/Text{isActive(item.code) View style{styles.option_icon} /}/TouchableOpacity )const isActive (code) selected.some(item item.code code)const activeItem (item) {setSelected((prev) {const newSelected [...prev]newSelected[level] { code: item.code, name: item.name }return newSelected.slice(0, level 1)})if (level 2) {const nextLevel level 1setLevel(nextLevel)setOptions((prev) {const nextOptions [...prev]nextOptions[nextLevel] item.childrenreturn nextOptions})}}const PanelTab () {const tabs selected.length 3 ? selected.concat({ name: 请选择 }) : selectedreturn (View style{styles.tab}{tabs.map((item, index) {return (View style{styles.tab_item} key{index}TouchableOpacity onPress{() setLevel(index)}Text style{item.code ? styles.tab_item_text : styles.tab_item_text_gray}{item.name}/Text/TouchableOpacity{level index View style{styles.tab_item_line} /}/View)})}/View)}return (PanelTab /FlatList style{styles.flat} data{options[level]} renderItem{renderItem} keyExtractor{item item.code} //) }const styles StyleSheet.create({flat: {height: 500,},option: {height: 40,paddingRight: 15,flexDirection: row,alignItems: center,justifyContent: space-between,},option_text: {fontSize: 14},option_text_active: {color: #409eff,fontWeight: bold,},option_icon: {width: 6,height: 10,borderBottomWidth: 2,borderBottomColor: #409eff,borderRightWidth: 2,borderRightColor: #409eff,transform: rotate(45deg)},tab: {flexDirection: row,marginBottom: 10,},tab_item: {position: relative,marginRight: 15,},tab_item_text: {fontSize: 14,fontWeight: bold,paddingBottom: 10,},tab_item_text_gray: {fontSize: 14,color: gray,paddingBottom: 10,},tab_item_line: {position: absolute,bottom: 0,left: 0,width: 100%,height: 3,borderRadius: 5,backgroundColor: #409eff} })
http://www.w-s-a.com/news/252998/

相关文章:

  • 做网站百度百科孟州网站建设
  • 服务网站建设企业广州模板建站系统
  • 怎么做属于自己的免费网站浏览器游戏网址
  • 上海城乡住房建设厅网站西安网站推广慧创科技
  • 做策划网站推广怎么写简历互联网公司手机网站
  • 怎么做宣传网站网站建设采购项目合同书
  • 网站的空间和域名备案做网站要会写什么
  • wap 网站源码企业网站被转做非法用途
  • 下载网站模板怎么使用做物流网站的公司
  • 网站 商城 app 建设建设银行江苏省行网站
  • 广州网站开发建设西安广告公司联系方式
  • 怎么用腾讯云服务器做网站个人网站开发视频
  • 网站建设技术代码坦洲网站建设公司哪家好
  • 阿里云对象存储做静态网站怎样做网站性能优化
  • 怎样做理财投资网站装修平面图用什么软件简单
  • 建手机wap网站大概多少钱苏州网站设计公司有哪些
  • 网站建设需求文件学校网站建设方案及报价
  • 网站开发一般多少钱wordpress打赏赞插件
  • 做中国o2o网站领导唐山网站制作软件
  • 门户网站简介做网站一天能接多少单
  • 论坛类网站建设遵义网站制作外包
  • vps服务器购买网站小视频做网站怎么赚钱
  • 网站用图片wordpress同步发布
  • 织梦图片自适应网站源码网页美工的设计要点
  • 渝快办官方网站wordpress产品图片怎么改
  • 高端网站特色深圳建网站哪
  • 宝塔搭建网站软文小故事200字
  • 公司网站设计免费虚拟主机网站源码
  • 怎样做好网站用户体验申请网站空间
  • 网站建设优化公司招聘福州网站建设思企