mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-04-16 21:02:42 +08:00
增加微信小程序版
This commit is contained in:
1
liferestartWX/utils/wux/actionsheet/index.js
Normal file
1
liferestartWX/utils/wux/actionsheet/index.js
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent")),_classNames7=_interopRequireDefault(require("../helpers/classNames"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(n,!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var defaults={prefixCls:"wux-actionsheet",theme:"ios",className:"",titleText:"",buttons:[],buttonClicked:function(){},cancelText:"取消",cancel:function(){}};(0,_baseComponent.default)({useFunc:!0,data:defaults,computed:{classes:["prefixCls, theme, buttons, cancelText",function(n,e,t,r){var o,c=(0,_classNames7.default)(n),a="".concat(n,"__popup"),s=(0,_classNames7.default)("".concat(n,"__content"),(_defineProperty(o={},"".concat(n,"__content--theme-").concat(e),e),_defineProperty(o,"".concat(n,"__content--has-cancel"),r),o)),i=(0,_classNames7.default)("".concat(n,"__group"),_defineProperty({},"".concat(n,"__group--options"),!0)),u="".concat(n,"__title"),d=(0,_classNames7.default)("".concat(n,"__button"),_defineProperty({},"".concat(n,"__button--destructive"),!0));return{wrap:c,popup:a,content:s,options:i,title:u,button:t.map(function(e){var t;return{wrap:(0,_classNames7.default)("".concat(n,"__button"),(_defineProperty(t={},"".concat(n,"__button--option"),!0),_defineProperty(t,"".concat(n,"__button--disabled"),e.disabled),_defineProperty(t,"".concat(e.className),e.className),t)),hover:e.hoverClass&&"default"!==e.hoverClass?e.hoverClass:"".concat(n,"__button--hover")}}),icon:"".concat(n,"__icon"),text:"".concat(n,"__text"),destructive:d,group:(0,_classNames7.default)("".concat(n,"__group"),_defineProperty({},"".concat(n,"__group--cancel"),!0)),cancel:(0,_classNames7.default)("".concat(n,"__button"),_defineProperty({},"".concat(n,"__button--cancel"),!0)),hover:"".concat(n,"__button--hover")}}]},methods:{showSheet:function(e){var t=0<arguments.length&&void 0!==e?e:{},n=this.$$mergeOptionsAndBindMethods(Object.assign({},defaults,t));return this.removed=!1,this.$$setData(_objectSpread({in:!0},n)),this.cancel.bind(this)},removeSheet:function(e){if(this.removed)return!1;this.removed=!0,this.$$setData({in:!1}),"function"==typeof e&&e(this.data.buttons)},buttonClicked:function(e){var t=e.currentTarget.dataset.index;!0===this.fns.buttonClicked(t,this.data.buttons[t])&&this.removeSheet()},destructiveButtonClicked:function(){!0===this.fns.destructiveButtonClicked()&&this.removeSheet()},cancel:function(){this.removeSheet(this.fns.cancel)},bindgetuserinfo:function(e){this.triggerEvent("getuserinfo",_objectSpread({},e.detail,{},e.currentTarget.dataset))},bindcontact:function(e){this.triggerEvent("contact",_objectSpread({},e.detail,{},e.currentTarget.dataset))},bindgetphonenumber:function(e){this.triggerEvent("getphonenumber",_objectSpread({},e.detail,{},e.currentTarget.dataset))},bindopensetting:function(e){this.triggerEvent("opensetting",_objectSpread({},e.detail,{},e.currentTarget.dataset))},onError:function(e){this.triggerEvent("error",_objectSpread({},e.detail,{},e.currentTarget.dataset))}}});
|
||||
6
liferestartWX/utils/wux/actionsheet/index.json
Normal file
6
liferestartWX/utils/wux/actionsheet/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"wux-popup": "../popup/index"
|
||||
}
|
||||
}
|
||||
41
liferestartWX/utils/wux/actionsheet/index.wxml
Normal file
41
liferestartWX/utils/wux/actionsheet/index.wxml
Normal file
@@ -0,0 +1,41 @@
|
||||
<wux-popup wux-content-class="{{ theme === 'ios' ? classes.popup : '' }}" position="bottom" visible="{{ in }}" safeArea="bottom" bind:close="cancel">
|
||||
<view class="wux-class {{ classes.wrap }}">
|
||||
<view class="{{ classes.content }}">
|
||||
<view class="{{ classes.options }}">
|
||||
<view class="{{ classes.title }}" wx:if="{{ titleText }}">{{ titleText }}</view>
|
||||
<block wx:for="{{ buttons }}" wx:for-item="button" wx:key="index">
|
||||
<button
|
||||
class="{{ classes.button[index].wrap }}"
|
||||
data-index="{{ index }}"
|
||||
disabled="{{ button.disabled }}"
|
||||
open-type="{{ button.openType }}"
|
||||
hover-class="{{ !button.disabled ? classes.button[index].hover : 'none' }}"
|
||||
hover-stop-propagation="{{ button.hoverStopPropagation }}"
|
||||
hover-start-time="{{ button.hoverStartTime }}"
|
||||
hover-stay-time="{{ button.hoverStayTime }}"
|
||||
lang="{{ button.lang }}"
|
||||
bindgetuserinfo="bindgetuserinfo"
|
||||
session-from="{{ button.sessionFrom }}"
|
||||
send-message-title="{{ button.sendMessageTitle }}"
|
||||
send-message-path="{{ button.sendMessagePath }}"
|
||||
send-message-img="{{ button.sendMessageImg }}"
|
||||
show-message-card="{{ button.showMessageCard }}"
|
||||
bindcontact="bindcontact"
|
||||
bindgetphonenumber="bindgetphonenumber"
|
||||
app-parameter="{{ button.appParameter }}"
|
||||
binderror="onError"
|
||||
bindopensetting="bindopensetting"
|
||||
catchtap="buttonClicked"
|
||||
>
|
||||
<image class="{{ classes.icon }}" src="{{ button.icon }}" wx:if="{{ button.icon }}" />
|
||||
<text class="{{ classes.text }}">{{ button.text }}</text>
|
||||
</button>
|
||||
</block>
|
||||
<button class="{{ classes.destructive }}" wx:if="{{ destructiveText }}" catchtap="destructiveButtonClicked">{{ destructiveText }}</button>
|
||||
</view>
|
||||
<view class="{{ classes.group }}" wx:if="{{ cancelText }}">
|
||||
<button class="{{ classes.cancel }}" hover-class="{{ classes.hover }}" catchtap="cancel">{{ cancelText }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</wux-popup>
|
||||
1
liferestartWX/utils/wux/actionsheet/index.wxss
Normal file
1
liferestartWX/utils/wux/actionsheet/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
.wux-actionsheet__popup{background-color:transparent}.wux-actionsheet__content{margin-left:16rpx;margin-right:16rpx;width:auto;overflow:hidden}.wux-actionsheet__content--theme-wx{margin-left:0;margin-right:0;margin-bottom:0}.wux-actionsheet__content--theme-wx .wux-actionsheet__group{border-radius:0;margin-bottom:12rpx}.wux-actionsheet__content--theme-wx .wux-actionsheet__group--options{background-color:#fff}.wux-actionsheet__content--theme-wx .wux-actionsheet__group--cancel{margin-bottom:0}.wux-actionsheet__content--theme-wx .wux-actionsheet__button{font-size:36rpx;color:#000}.wux-actionsheet__content--theme-wx .wux-actionsheet__button--cancel{font-weight:400}.wux-actionsheet__content--theme-wx.wux-actionsheet__content--has-cancel{background-color:#efeff4}.wux-actionsheet__group{margin-bottom:16rpx;border-radius:8rpx;background-color:#fff;overflow:hidden}.wux-actionsheet__group--options{background-color:#f1f2f3}.wux-actionsheet__title{padding:32rpx;color:#8f8f8f;text-align:center;font-size:26rpx}.wux-actionsheet__button{position:relative;display:block;margin:0;padding:0;min-width:104rpx;min-height:96rpx;vertical-align:top;text-align:center;text-overflow:ellipsis;cursor:pointer;width:100%;border-radius:0;background-color:transparent;color:#007aff;font-size:42rpx;line-height:96rpx;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.wux-actionsheet__button--hover{box-shadow:none;border-color:#d1d3d6;color:#007aff;background:#e4e5e7}.wux-actionsheet__button--destructive{color:#ff3b30!important}.wux-actionsheet__button--cancel{font-weight:500}.wux-actionsheet__button--disabled{opacity:.3!important}.wux-actionsheet__group .wux-actionsheet__button{border-top:none}.wux-actionsheet__group .wux-actionsheet__button::after{transform:none;transform-origin:none;border:none;border-radius:0;content:" ";position:absolute;left:0;top:0;right:0;height:1PX;border-top:1PX solid #d9d9d9;color:#d9d9d9;transform-origin:0 0;transform:scaleY(.5)}.wux-actionsheet__group .wux-actionsheet__button:first-child:last-child::after{border-width:0}.wux-actionsheet__icon{width:48rpx;height:48rpx;display:inline-block;margin-right:20rpx}
|
||||
Reference in New Issue
Block a user