选项式工具 API
$popup
获取弹出层控制器实例。
类型
ts
const $popup: IController详细信息
弹出层控制器实例,已自动同步当前组件上下文。
示例
ts
export default defineComponent({
methods: {
handlePopup() {
this.$popup.render({
component: () => import('./HelloPopup.vue'),
})
},
},
})相关参考
$popupInstanceId 1.6.0+
获取当前组件所在弹出层的实例 ID。
类型
ts
const $popupInstanceId: InstanceId | undefined详细信息
如果当前组件并不是通过弹出层渲染,则返回 undefined。
示例
ts
export default defineComponent({
methods: {
handleClose() {
this.$popup.destroy(this.$popupInstanceId!)
},
},
})相关参考
$popupComputedStyle 1.6.0+
获取当前组件所在弹出层的计算样式。
类型
ts
const $popupComputedStyle: ComputedStyle | undefined详细信息
返回的所有样式都是具有响应性的,方便开发者获取当前弹出层视图的实时计算样式。
如果当前组件并不是通过弹出层渲染,则返回 undefined。
示例
ts
export default defineComponent({
watch: {
$popupComputedStyle(newStyle) {
console.log('$popupComputedStyle changed: ', newStyle)
},
},
})