实现弹框方式主要是LayerLinkOverlayEntry,具体实现方式网上有很多类似代码,本文主要记录一下“弹框组件CompositedTransformFollower”相对于“触发弹框组件CompositedTransformTarget”的对齐方式,对齐方式主要取决于CompositedTransformFollower组件的两个参数:targetAnchorfollowerAnchor

对齐方式如下(12中对齐方式主要参考elementui 的 tooltip 组件):

targetAnchorfollowerAnchor 对应参数如下:


// targetAnchor、followerAnchor 默认值为 topLeft

// 左上
// followerAnchor: Alignment.topRight,
// 左中
// targetAnchor: Alignment.centerLeft,
// followerAnchor: Alignment.centerRight,
// 左下
// targetAnchor: Alignment.bottomLeft,
// followerAnchor: Alignment.bottomRight,

// 右上
// targetAnchor: Alignment.topRight,
// 右中
// targetAnchor: Alignment.centerRight,
// followerAnchor: Alignment.centerLeft,
// 右下
// targetAnchor: Alignment.bottomRight,
// followerAnchor: Alignment.bottomLeft,

// 上左
// targetAnchor: Alignment.topLeft,
// followerAnchor: Alignment.bottomLeft,
// 上中
// targetAnchor: Alignment.topCenter,
// followerAnchor: Alignment.bottomCenter,
// 上右
// targetAnchor: Alignment.topRight,
// followerAnchor: Alignment.bottomRight,

// 下左
// targetAnchor: Alignment.bottomLeft,
// followerAnchor: Alignment.topLeft,
// 下中
// targetAnchor: Alignment.bottomCenter,
// followerAnchor: Alignment.topCenter,
// 下右
// targetAnchor: Alignment.bottomRight,
// followerAnchor: Alignment.topRight,

qngyun1029
980 声望15 粉丝