AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

to

描述

to 方法用于在NavEdge中导航到另一个页面,支持传递参数和可选配置项。

语法

navEdge.to(target: string, params: object, options: object)

参数

  • target:(必选) 要导航到的页面名称。
  • params:(可选) 一个包含传递的参数的对象。参数将作为查询字符串添加到导航的URL中。
  • options:(可选) 一个包含可选配置的对象。

配置选项

  • replace:(可选) 布尔值,表示是否替换当前历史记录项而不是添加新的项。默认为false
  • reload:(可选) 布尔值,表示是否重新加载页面,而不是从缓存中加载。默认为false

示例

// 导航到目标页面
navEdge.to('about');

// 传递参数
navEdge.to('product', { id: 123 });

// 传递参数和选项
navEdge.to('profile', { username: 'foo' }, { replace: true, reload: true });

注意事项

  • 如果您尝试导航到当前已经被加载的页面,则不会触发导航,但参数和选项仍然会被应用。
  • 如果您使用了replace选项,则页面将被替换为新页面,浏览器将无法回退到之前的页面。请小心使用此选项,以避免意外的行为。