712 lines
21 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should render demo and match snapshot 1`] = `
<main>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
基础用法
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
/>
<wx-view
class="van-uploader__upload "
style="width:80px;height:80px"
bind:tap="startUpload"
>
<van-icon
class="van-uploader__upload-icon"
>
<wx-view
class="custom-class van-icon van-icon-photograph"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
上传视频
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
/>
<wx-view
class="van-uploader__upload "
style="width:80px;height:80px"
bind:tap="startUpload"
>
<van-icon
class="van-uploader__upload-icon"
>
<wx-view
class="custom-class van-icon van-icon-photograph"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
文件预览
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__preview"
data-index="{{0}}"
bind:tap="onClickPreview"
>
<wx-image
alt="图片0"
class="van-uploader__preview-image"
data-index="{{0}}"
mode="scaleToFill"
src="https://img.yzcdn.cn/vant/leaf.jpg"
style="width:80px;height:80px"
bind:tap="onPreviewImage"
/>
<wx-view
class="van-uploader__preview-delete"
data-index="{{0}}"
catch:tap="deleteItem"
>
<van-icon
class="van-uploader__preview-delete-icon"
>
<wx-view
class="custom-class van-icon van-icon-cross"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
<wx-view
class="van-uploader__preview"
data-index="{{1}}"
bind:tap="onClickPreview"
>
<wx-image
alt="图片1"
class="van-uploader__preview-image"
data-index="{{1}}"
mode="scaleToFill"
src="https://img.yzcdn.cn/vant/tree.jpg"
style="width:80px;height:80px"
bind:tap="onPreviewImage"
/>
<wx-view
class="van-uploader__preview-delete"
data-index="{{1}}"
catch:tap="deleteItem"
>
<van-icon
class="van-uploader__preview-delete-icon"
>
<wx-view
class="custom-class van-icon van-icon-cross"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
/>
<wx-view
class="van-uploader__upload "
style="width:80px;height:80px"
bind:tap="startUpload"
>
<van-icon
class="van-uploader__upload-icon"
>
<wx-view
class="custom-class van-icon van-icon-photograph"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
隐藏上传按钮
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__preview"
data-index="{{0}}"
bind:tap="onClickPreview"
>
<wx-image
alt="图片0"
class="van-uploader__preview-image"
data-index="{{0}}"
mode="scaleToFill"
src="https://img.yzcdn.cn/vant/leaf.jpg"
style="width:80px;height:80px"
bind:tap="onPreviewImage"
/>
<wx-view
class="van-uploader__preview-delete"
data-index="{{0}}"
catch:tap="deleteItem"
>
<van-icon
class="van-uploader__preview-delete-icon"
>
<wx-view
class="custom-class van-icon van-icon-cross"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
<wx-view
class="van-uploader__preview"
data-index="{{1}}"
bind:tap="onClickPreview"
>
<wx-image
alt="图片1"
class="van-uploader__preview-image"
data-index="{{1}}"
mode="scaleToFill"
src="https://img.yzcdn.cn/vant/tree.jpg"
style="width:80px;height:80px"
bind:tap="onPreviewImage"
/>
<wx-view
class="van-uploader__preview-delete"
data-index="{{1}}"
catch:tap="deleteItem"
>
<van-icon
class="van-uploader__preview-delete-icon"
>
<wx-view
class="custom-class van-icon van-icon-cross"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
/>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
上传状态
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__preview"
data-index="{{0}}"
bind:tap="onClickPreview"
>
<wx-image
alt="图片0"
class="van-uploader__preview-image"
data-index="{{0}}"
mode="scaleToFill"
src="https://img.yzcdn.cn/vant/leaf.jpg"
style="width:80px;height:80px"
bind:tap="onPreviewImage"
/>
<wx-view
class="van-uploader__mask"
>
<van-loading
customClass="van-uploader__loading"
>
<wx-view
class="custom-class van-loading"
>
<wx-view
class="van-loading__spinner van-loading__spinner--circular"
style=""
/>
<wx-view
class="van-loading__text"
style=""
/>
</wx-view>
</van-loading>
<wx-text
class="van-uploader__mask-message"
>
上传中
</wx-text>
</wx-view>
<wx-view
class="van-uploader__preview-delete"
data-index="{{0}}"
catch:tap="deleteItem"
>
<van-icon
class="van-uploader__preview-delete-icon"
>
<wx-view
class="custom-class van-icon van-icon-cross"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
<wx-view
class="van-uploader__preview"
data-index="{{1}}"
bind:tap="onClickPreview"
>
<wx-image
alt="图片1"
class="van-uploader__preview-image"
data-index="{{1}}"
mode="scaleToFill"
src="https://img.yzcdn.cn/vant/tree.jpg"
style="width:80px;height:80px"
bind:tap="onPreviewImage"
/>
<wx-view
class="van-uploader__mask"
>
<van-icon
class="van-uploader__mask-icon"
>
<wx-view
class="custom-class van-icon van-icon-close"
style=""
bind:tap="onClick"
/>
</van-icon>
<wx-text
class="van-uploader__mask-message"
>
上传失败
</wx-text>
</wx-view>
<wx-view
class="van-uploader__preview-delete"
data-index="{{1}}"
catch:tap="deleteItem"
>
<van-icon
class="van-uploader__preview-delete-icon"
>
<wx-view
class="custom-class van-icon van-icon-cross"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
限制上传数量
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__preview"
data-index="{{0}}"
bind:tap="onClickPreview"
>
<wx-image
alt="图片0"
class="van-uploader__preview-image"
data-index="{{0}}"
mode="scaleToFill"
src="https://img.yzcdn.cn/vant/sand.jpg"
style="width:80px;height:80px"
bind:tap="onPreviewImage"
/>
<wx-view
class="van-uploader__preview-delete"
data-index="{{0}}"
catch:tap="deleteItem"
>
<van-icon
class="van-uploader__preview-delete-icon"
>
<wx-view
class="custom-class van-icon van-icon-cross"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
/>
<wx-view
class="van-uploader__upload "
style="width:80px;height:80px"
bind:tap="startUpload"
>
<van-icon
class="van-uploader__upload-icon"
>
<wx-view
class="custom-class van-icon van-icon-photograph"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
自定义上传样式
</wx-view>
<van-uploader
useSlot="{{true}}"
bind:after-read="afterRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
>
<van-button>
<wx-button
appParameter=""
ariaLabel=""
businessId="{{0}}"
class="custom-class van-button van-button--primary van-button--normal "
data-detail="{{null}}"
formType=""
hoverClass="van-button--active hover-class"
id=""
lang=""
openType=""
sendMessageImg=""
sendMessagePath=""
sendMessageTitle=""
sessionFrom=""
showMessageCard="{{false}}"
style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar"
bind:contact="onContact"
bind:error="onError"
bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting"
bind:tap="onClick"
>
<van-icon
class="van-button__icon"
>
<wx-view
class="custom-class van-icon van-icon-photo"
style="font-size:1.2em;line-height: inherit;"
bind:tap="onClick"
/>
</van-icon>
<wx-view
class="van-button__text"
>
上传图片
</wx-view>
</wx-button>
</van-button>
</wx-view>
<wx-view
class="van-uploader__upload "
style="width:80px;height:80px"
bind:tap="startUpload"
>
<van-icon
class="van-uploader__upload-icon"
>
<wx-view
class="custom-class van-icon van-icon-photograph"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
上传前校验
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:before-read="beforeRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
/>
<wx-view
class="van-uploader__upload "
style="width:80px;height:80px"
bind:tap="startUpload"
>
<van-icon
class="van-uploader__upload-icon"
>
<wx-view
class="custom-class van-icon van-icon-photograph"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
</wx-view>
</demo-block>
<demo-block>
<wx-view
class="custom-class demo-block van-clearfix demo-block--padding"
>
<wx-view
class="demo-block__title"
>
云存储上传
</wx-view>
<van-uploader
bind:after-read="afterRead"
bind:before-read="beforeRead"
bind:click-preview="clickPreview"
bind:delete="delete"
>
<wx-view
class="van-uploader"
>
<wx-view
class="van-uploader__wrapper"
>
<wx-view
class="van-uploader__slot"
bind:tap="startUpload"
/>
<wx-view
class="van-uploader__upload "
style="width:80px;height:80px"
bind:tap="startUpload"
>
<van-icon
class="van-uploader__upload-icon"
>
<wx-view
class="custom-class van-icon van-icon-photograph"
style=""
bind:tap="onClick"
/>
</van-icon>
</wx-view>
</wx-view>
</wx-view>
</van-uploader>
<wx-view
class="demo-margin-bottom"
>
<van-button
bind:click="uploadToCloud"
>
<wx-button
appParameter=""
ariaLabel=""
businessId="{{0}}"
class="custom-class van-button van-button--primary van-button--normal "
data-detail="{{null}}"
formType=""
hoverClass="van-button--active hover-class"
id=""
lang=""
openType=""
sendMessageImg=""
sendMessagePath=""
sendMessageTitle=""
sessionFrom=""
showMessageCard="{{false}}"
style=""
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:chooseavatar="onChooseAvatar"
bind:contact="onContact"
bind:error="onError"
bind:getphonenumber="onGetPhoneNumber"
bind:getrealtimephonenumber="onGetRealTimePhoneNumber"
bind:getuserinfo="onGetUserInfo"
bind:launchapp="onLaunchApp"
bind:opensetting="onOpenSetting"
bind:tap="onClick"
>
<wx-view
class="van-button__text"
>
上传至云存储
</wx-view>
</wx-button>
</van-button>
</wx-view>
</wx-view>
</demo-block>
</main>
`;