row and col

本文介绍了布局组件中的行和列配置方法,包括不同屏幕尺寸下的间距设置。行使用gutter属性来定义间距,列则通过md和sm属性适配中屏和小屏设备。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.行

<Row gutter={{ md: 6, lg: 12, xl: 12 }}></Row>

gutter:

md: 中等屏幕 桌面显示器 (≥992px)

lg: 大屏幕 大桌面显示器 (≥1200px)

xl:

2.列

<Col md={6} sm={24}></Col>

md: 中等屏幕 桌面显示器 (≥992px)

sm: 小屏幕 平板 (≥768px)

import heapq def is_channel_position(row, col): return (row + 1 in channel_rows) or (col in channel_cols) def is_target_node(row, col): current_row_number = row + 1 # 检查是否在通道行 if current_row_number in channel_rows: # 检查上方行(row+1)是否为空车位 if (row + 1 < total_rows) and ((row + 2) not in channel_rows) and (col not in channel_cols): if not occupied[row + 1][col]: return True # 检查下方行(row-1)是否为空车位 if (row - 1 >= 0) and (current_row_number - 1 not in channel_rows) and (col not in channel_cols): if not occupied[row - 1][col]: return True # 检查是否在通道列 if col in channel_cols: # 检查左列(col-1)是否为空车位 if (col - 1 >= 0) and (col - 1 not in channel_cols) and (current_row_number not in channel_rows): if not occupied[row][col - 1]: return True # 检查右列(col+1)是否为空车位 if (col + 1 < total_cols) and (col + 1 not in channel_cols) and (current_row_number not in channel_rows): if not occupied[row][col + 1]: return True return False # 构建邻接表 graph = {} target_nodes = [] for row in range(total_rows): for col in range(total_cols): if not is_channel_position(row, col): continue node = (row, col) graph[node] = [] # 横向移动(通道行) if (row + 1) in channel_rows: if col > 0 and is_channel_position(row, col - 1): cost = column_widths[col - 1] graph[node].append(((row, col - 1), cost)) if col < total_cols - 1 and is_channel_position(row, col + 1): cost = column_widths[col] graph[node].append(((row, col + 1), cost)) # 纵向移动(通道列) if col in channel_cols: if row > 0 and is_channel_position(row - 1, col): cost = row_heights[row - 1] graph[node].append(((row - 1, col), cost)) if row < total_rows - 1 and is_channel_position(row + 1, col): cost = row_heights[row] graph[node].append(((row + 1, col), cost)) # 标记目标节点 if is_target_node(row, col): target_nodes.append(node) # Dijkstra算法 heap = [] heapq.heappush(heap, (0, entrance)) distances = {entrance: 0} predecessors = {} while heap: current_dist, current_node = heapq.heappop(heap) if current_node in target_nodes: break for neighbor, weight in graph.get(current_node, []): new_dist = current_dist + weight if new_dist < distances.get(neighbor, float('inf')): distances[neighbor] = new_dist predecessors[neighbor] = current_node heapq.heappush(heap, (new_dist, neighbor)) # 回溯路径 path = [] node = current_node while node in predecessors: path.append(node) node = predecessors[node] path.append(entrance) path.reverse() print(f"最短路径长度:{current_dist}") print("路径:", path)能把空车位也加入路径中吗
03-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值