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

copy

简介

copy 方法是 Yuka 库中的一个工具方法,用于将指定字符串文本复制到系统剪贴板中。

语法

copy(text)

参数

text:要复制到系统剪贴板的字符串文本。

使用案例

import { copy } from 'yuka';

// 复制文本到系统剪贴板
copy('Hello World!');

浏览器兼容性

copy 方法在以下浏览器中被支持:

  • Chrome 42+
  • Edge 12+
  • Firefox 41+
  • Opera 29+
  • Safari 10+

注意事项

  • 在 Safari 10 中,copy 方法只能在 HTTPS 页面上使用。
  • 在 Firefox 63 以前,copy 方法只能在可视状态下的窗口中被调用,例如不能在后台标签页中使用此方法。
  • 如果要兼容不支持 copy 方法的浏览器,可以使用 clipboard.js 库来实现类似的功能。