调整文档,模态框添加屏蔽头部配置

This commit is contained in:
KeiferJu 2020-05-08 09:59:58 +08:00
parent 6be921194a
commit dda87e3c9d
3 changed files with 123 additions and 5 deletions

View File

@ -1,9 +1,22 @@
<script context="module">
export async function preload() {
const res = await this.fetch(`components/carousel.json`);
const jsdoc = await res.json();
return {
jsdoc
};
}
</script>
<script> <script>
import { import {
Carousel Carousel
} from 'svelma-pro' } from 'svelma-pro'
import DocHeader from '../../components/DocHeader.svelte' import DocHeader from '../../components/DocHeader.svelte'
import Example from '../../components/Example.svelte' import Example from '../../components/Example.svelte'
import JSDoc from '../../components/JSDoc.svelte'
export let jsdoc
let options = [ let options = [
'http://dev.smartmapx.com/assets/source-img/banner/banner.jpg', 'http://dev.smartmapx.com/assets/source-img/banner/banner.jpg',
@ -38,4 +51,6 @@
<div slot="preview" class="preview"> <div slot="preview" class="preview">
<Carousel options={options} /> <Carousel options={options} />
</div> </div>
</Example> </Example>
<JSDoc {jsdoc}></JSDoc>

View File

@ -72,6 +72,89 @@
"values": "<code>Any animation that ships with Svelte</code>" "values": "<code>Any animation that ships with Svelte</code>"
} }
], ],
"Carousel":[
{
"description": "图片列表(url路径数组)",
"type": [
"Array"
],
"defaultvalue": [],
"name": "options",
"values": ""
},
{
"description": "底部指示器",
"type": [
"Boolean"
],
"defaultvalue": true,
"name": "pagination",
"values": ""
},
{
"description": "左右导航按钮",
"type": [
"Boolean"
],
"defaultvalue": true,
"name": "navigation",
"values": ""
},
{
"description": "自动播放",
"type": [
"Boolean"
],
"defaultvalue": false,
"name": "autoplay",
"values": ""
},
{
"description": "自动播放时长",
"type": [
"Number"
],
"defaultvalue": 3000,
"name": "delay",
"values": ""
},
{
"description": "方向",
"type": [
"String"
],
"defaultvalue": "horizontal",
"name": "direction",
"values": "horizontal,vertical"
},
{
"description": "循环",
"type": [
"Boolean"
],
"defaultvalue": true,
"name": "loop",
"values": ""
},
{
"description": "滑动禁止自动播放",
"type": [
"Boolean"
],
"defaultvalue": true,
"name": "disableOnInteraction",
"values": ""
},
{
"description": "切换特效",
"type": [
"String"
],
"defaultvalue": "slide",
"name": "effect",
"values": "slide,fade,cube,coverflow,flip"
}
],
"Datepicker": [ "Datepicker": [
{ {
"description": "当前日期", "description": "当前日期",
@ -1048,6 +1131,14 @@
"defaultvalue": "true", "defaultvalue": "true",
"name": "backdropClose", "name": "backdropClose",
"values": "" "values": ""
},{
"description": "是否显示头部",
"type": [
"Boolean"
],
"defaultvalue": "true",
"name": "showHeader",
"values": ""
}, },
{ {
"isEvent": true, "isEvent": true,

View File

@ -10,6 +10,7 @@
export let animProps = { start: 1.2 } export let animProps = { start: 1.2 }
export let size = '' export let size = ''
export let showClose = true //显示左上角关闭按钮 export let showClose = true //显示左上角关闭按钮
export let showHeader = true //是否显示头
export let backdrop = true // 遮罩 export let backdrop = true // 遮罩
export let backdropClose = true // 点击遮罩是否关闭 export let backdropClose = true // 点击遮罩是否关闭
export const subComponent = null export const subComponent = null
@ -53,6 +54,11 @@
padding: 10px 20px; padding: 10px 20px;
text-align: center; text-align: center;
} }
.delete {
position: absolute;
top: 20px;
right: 10px;
}
</style> </style>
<svelte:window on:keydown={keydown} /> <svelte:window on:keydown={keydown} />
@ -67,12 +73,18 @@
}} /> }} />
{/if} {/if}
<div class="modal-card" transition:_animation|local={animProps} style="width: {width};height: {height}"> <div class="modal-card" transition:_animation|local={animProps} style="width: {width};height: {height}">
<header class="modal-card-head"> {#if showHeader}
<p class="modal-card-title">{title}</p> <header class="modal-card-head">
{#if showClose} <p class="modal-card-title">{title}</p>
</header>
{/if}
{#if showClose}
{#if showHeader}
<button class="delete" aria-label="close" on:click={close} /> <button class="delete" aria-label="close" on:click={close} />
{:else}
<button class="delete" aria-label="close" on:click={close} style="top: 2px;right: 2px;" />
{/if} {/if}
</header> {/if}
<section class="modal-card-body"> <section class="modal-card-body">
<slot /> <slot />
</section> </section>