提交初始版本,使用vant ui库

This commit is contained in:
2024-02-01 14:38:56 +08:00
commit 787a1f26b6
480 changed files with 12239 additions and 0 deletions

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
// whether to show popup
show: Boolean,
// overlay custom style
overlayStyle: String,
// z-index
zIndex: {
type: Number,
value: 100,
},
title: String,
cancelText: {
type: String,
value: '取消',
},
description: String,
options: {
type: Array,
value: [],
},
overlay: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
duration: {
type: null,
value: 300,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onClickOverlay: function () {
this.$emit('click-overlay');
},
onCancel: function () {
this.onClose();
this.$emit('cancel');
},
onSelect: function (event) {
this.$emit('select', event.detail);
},
onClose: function () {
this.$emit('close');
},
},
});

View File

@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"van-popup": "../popup/index",
"options": "./options"
}
}

View File

@@ -0,0 +1,47 @@
<wxs src="./index.wxs" module="computed" />
<van-popup
round
class="van-share-sheet"
show="{{ show }}"
position="bottom"
overlay="{{ overlay }}"
duration="{{ duration }}"
z-index="{{ zIndex }}"
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:close="onClose"
bind:click-overlay="onClickOverlay"
>
<view class="van-share-sheet__header">
<view class="van-share-sheet__title">
<slot name="title" />
</view>
<view wx:if="{{ title }}" class="van-share-sheet__title">{{ title }}</view>
<view class="van-share-sheet__description">
<slot name="description" />
</view>
<view wx:if="{{ description }}" class="van-share-sheet__description">
{{ description }}
</view>
</view>
<block wx:if="{{ computed.isMulti(options) }}">
<options
wx:for="{{ options }}"
show-border="{{ index !== 0 }}"
wx:key="index"
options="{{ item }}"
bind:select="onSelect"
/>
</block>
<options wx:else options="{{ options }}" bind:select="onSelect" />
<button type="button" class="van-share-sheet__cancel" bindtap="onCancel">
{{ cancelText }}
</button>
</van-popup>

View File

@@ -0,0 +1,12 @@
/* eslint-disable */
function isMulti(options) {
if (options == null || options[0] == null) {
return false;
}
return "Array" === options.constructor && "Array" === options[0].constructor;
}
module.exports = {
isMulti: isMulti
};

View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-share-sheet__header{padding:12px 16px 4px;text-align:center}.van-share-sheet__title{color:#323233;font-size:14px;font-weight:400;line-height:20px;margin-top:8px}.van-share-sheet__title:empty,.van-share-sheet__title:not(:empty)+.van-share-sheet__title{display:none}.van-share-sheet__description{color:#969799;display:block;font-size:12px;line-height:16px;margin-top:8px}.van-share-sheet__description:empty,.van-share-sheet__description:not(:empty)+.van-share-sheet__description{display:none}.van-share-sheet__cancel{background:#fff;border:none;box-sizing:initial;display:block;font-size:16px;height:auto;line-height:48px;padding:0;text-align:center;width:100%}.van-share-sheet__cancel:before{background-color:#f7f8fa;content:" ";display:block;height:8px}.van-share-sheet__cancel:after{display:none}.van-share-sheet__cancel:active{background-color:#f2f3f5}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,27 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
options: Array,
showBorder: Boolean,
},
methods: {
onSelect: function (event) {
var index = event.currentTarget.dataset.index;
var option = this.data.options[index];
this.$emit('select', __assign(__assign({}, option), { index: index }));
},
},
});

View File

@@ -0,0 +1,3 @@
{
"component": true
}

View File

@@ -0,0 +1,20 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./options.wxs" module="computed" />
<view class="{{ utils.bem('share-sheet__options', { border: showBorder }) }}">
<view
wx:for="{{ options }}"
wx:key="index"
class="van-share-sheet__option"
data-index="{{ index }}"
bindtap="onSelect"
>
<button class="van-share-sheet__button" open-type="{{ item.openType }}">
<image src="{{ computed.getIconURL(item.icon) }}" class="van-share-sheet__icon" />
<view wx:if="{{ item.name }}" class="van-share-sheet__name">{{ item.name }}</view>
<view wx:if="{{ item.description }}" class="van-share-sheet__option-description">
{{ item.description }}
</view>
</button>
</view>
</view>

View File

@@ -0,0 +1,14 @@
/* eslint-disable */
var PRESET_ICONS = ['qq', 'link', 'weibo', 'wechat', 'poster', 'qrcode', 'weapp-qrcode', 'wechat-moments'];
function getIconURL(icon) {
if (PRESET_ICONS.indexOf(icon) !== -1) {
return 'https://img.yzcdn.cn/vant/share-sheet-' + icon + '.png';
}
return icon;
}
module.exports = {
getIconURL: getIconURL,
};

View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-share-sheet__options{-webkit-overflow-scrolling:touch;display:flex;overflow-x:auto;overflow-y:visible;padding:16px 0 16px 8px;position:relative}.van-share-sheet__options--border:before{border-top:1px solid #ebedf0;box-sizing:border-box;content:" ";left:16px;pointer-events:none;position:absolute;right:0;top:0;transform:scaleY(.5);transform-origin:center}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{align-items:center;display:flex;flex-direction:column;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{background-color:initial;border:0;height:auto;line-height:inherit;padding:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{height:48px;margin:0 16px;width:48px}.van-share-sheet__name{color:#646566;font-size:12px;margin-top:8px;padding:0 4px}.van-share-sheet__option-description{color:#c8c9cc;font-size:12px;padding:0 4px}