弹出式是一个弹出窗口,其中包含任何在应用主内容之上弹出的 HTML 内容。弹出式与所有其他叠加层一样,是所谓的“临时视图”的一部分。
包含以下组件
Popup
- 弹出式元素名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
backdrop | 布尔值 | true | 启用弹出式背景(弹出式后面半透明的暗层) |
colors | 对象 | 包含 Tailwind CSS 颜色类别的对象 | |
colors.bg | 字符串 | 'bg-white dark:bg-black' | 弹出式背景颜色 |
component | 字符串 | 'div' | 组件的 HTML 元素 |
opened | 布尔值 | false | 允许打开/关闭弹出式并设置其初始状态 |
size | 字符串 | 'w-screen h-screen md:w-160 md:h-160' | Tailwind CSS 尺寸类别 |
名称 | 类型 | 描述 |
---|---|---|
backdropclick | 函数(e) | 背景元素上的单击处理程序 |
<template><k-page><k-navbar title="Popup" /><k-block strong class="space-y-4"><p>Popup is a modal window with any HTML content that pops up over App'smain content. Popup as all other overlays is part of so called"Temporary Views".</p><p><k-button @click="() => (popupOpened = true)">Open Popup</k-button></p></k-block><k-popup :opened="popupOpened" @backdropclick="() => (popupOpened = false)"><k-page><k-navbar title="Popup"><template #right><k-link navbar @click="() => (popupOpened = false)"> Close </k-link></template></k-navbar><k-block class="space-y-4"><p>Here comes popup. You can put here anything, even independent viewwith its own navigation. Also not, that by default popup looks a bitdifferent on iPhone/iPod and iPad, on iPhone it is fullscreen.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendissefaucibus mauris leo, eu bibendum neque congue non. Ut leo mauris,eleifend eu commodo a, egestas ac urna. Maecenas in lacus faucibus,viverra ipsum pulvinar, molestie arcu. Etiam lacinia venenatisdignissim. Suspendisse non nisl semper tellus malesuada suscipit euet eros. Nulla eu enim quis quam elementum vulputate. Mauris ornareconsequat nunc viverra pellentesque. Aenean semper eu massa sit ametaliquam. Integer et neque sed libero mollis elementum at vitaeligula. Vestibulum pharetra sed libero sed porttitor. Suspendisse afaucibus lectus.</p><p>Duis ut mauris sollicitudin, venenatis nisi sed, luctus ligula.Phasellus blandit nisl ut lorem semper pharetra. Nullam tortor nibh,suscipit in consequat vel, feugiat sed quam. Nam risus libero,auctor vel tristique ac, malesuada ut ante. Sed molestie, est ineleifend sagittis, leo tortor ullamcorper erat, at vulputate erossapien nec libero. Mauris dapibus laoreet nibh quis bibendum. Fuscedolor sem, suscipit in iaculis id, pharetra at urna. Pellentesquetempor congue massa quis faucibus. Vestibulum nunc eros, convallisblandit dui sit amet, gravida adipiscing libero.</p></k-block></k-page></k-popup></k-page></template><script>import { ref } from 'vue';import {kPage,kNavbar,kNavbarBackLink,kPopup,kBlock,kLink,kButton,} from 'konsta/vue';export default {components: {kPage,kNavbar,kNavbarBackLink,kPopup,kBlock,kLink,kButton,},setup() {const popupOpened = ref(false);return {popupOpened,};},};</script>