-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.2版本更新: 1. fix bug 2. 【增强】 增加组件 form-page 表单页 3. 【增强】 增加组件 actionsh…
…eet 模拟原生actionsheet 4. 【优化】 优化 slideview 右滑操作UI
- Loading branch information
Showing
64 changed files
with
1,603 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@import "../weui-wxss/src/style/widget/weui-tips/weui-mask.wxss"; | ||
@import "../weui-wxss/src/style/widget/weui-tips/weui-actionsheet.wxss"; | ||
|
||
.weui-mask.weui-mask_hidden { | ||
opacity: 0; | ||
transform: scale3d(1, 1, 0) | ||
} | ||
.weui-mask{ | ||
opacity: 1; | ||
transform: scale3d(1, 1, 1); | ||
transition: all 0.3s; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Component({ | ||
options: { | ||
multipleSlots: true, // 在组件定义时的选项中启用多slot支持 | ||
addGlobalClass: true | ||
}, | ||
properties: { | ||
title: { // 标题 | ||
type: String, | ||
value: '' | ||
}, | ||
showCancel: { // 是否显示取消按钮 | ||
type: Boolean, | ||
value: true | ||
}, | ||
cancelText: { // 取消按钮文案 | ||
type: String, | ||
value: '取消' | ||
}, | ||
maskClass: { // 遮罩层class | ||
type: String, | ||
value: '' | ||
}, | ||
extClass: { // 弹出窗 class | ||
type: String, | ||
value: '' | ||
}, | ||
maskClosable: { // 点击遮罩 关闭 actionsheet | ||
type: Boolean, | ||
value: true, | ||
}, | ||
mask: { // 是否需要 遮罩层 | ||
type: Boolean, | ||
value: true | ||
}, | ||
show: { // 是否开启 actionsheet | ||
type: Boolean, | ||
value: false | ||
}, | ||
actions: { // actions 列表 | ||
type: Array, | ||
value: [], // {text, extClass} | ||
observer: '_groupChange' | ||
} | ||
}, | ||
|
||
methods: { | ||
_groupChange(e) { | ||
// 支持 一维数组 写法 | ||
if(e.length > 0 && typeof e[0] !== 'string' && !(e[0] instanceof Array)) { | ||
this.setData({ | ||
actions: [this.data.actions] | ||
}) | ||
} | ||
}, | ||
buttonTap(e) { | ||
const { value, groupindex, index } = e.currentTarget.dataset | ||
this.triggerEvent('actiontap', { value, groupindex, index }) | ||
}, | ||
closeActionSheet(e) { | ||
const { type } = e.currentTarget.dataset | ||
if(this.data.maskClosable || type) { | ||
// 点击 action 里面的 取消 | ||
this.setData({ | ||
show: false | ||
}) | ||
// 关闭回调事件 | ||
this.triggerEvent('close') | ||
} | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<wxs module="utils"> | ||
var join = function(a,b) { | ||
return a+b | ||
}; | ||
var isNotSlot = function(v) { | ||
return typeof v !== 'string' | ||
} | ||
module.exports = { | ||
join: join, | ||
isNotSlot: isNotSlot | ||
} | ||
</wxs> | ||
|
||
<view wx:if="{{mask}}" class="weui-mask {{show ? '' : 'weui-mask_hidden'}} {{maskClass}}" bindtap="closeActionSheet"></view> | ||
<view class="weui-actionsheet {{show ? 'weui-actionsheet_toggle' : ''}} {{extClass}}"> | ||
<!-- 标题 --> | ||
<block wx:if="{{title}}"> | ||
<view class="weui-actionsheet__title"> | ||
<view class="weui-actionsheet__title-text">{{title}}</view> | ||
</view> | ||
</block> | ||
<slot name="title" wx:else></slot> | ||
<view | ||
class="{{ !showCancel && index === actions.length-1 ? 'weui-actionsheet__action' : 'weui-actionsheet__menu' }}" | ||
wx:key="{{index}}" | ||
wx:for-item="actionItem" | ||
wx:for-index="index" | ||
wx:for="{{actions}}" | ||
> | ||
<block wx:if="{{utils.isNotSlot(actionItem)}}"> | ||
<view | ||
class="weui-actionsheet__cell {{item.type === 'warn' ? 'weui-actionsheet__cell_warn' : '' }}" | ||
wx:key="{{item.text}}" | ||
wx:for="{{actionItem}}" | ||
wx:for-index="actionIndex" | ||
data-groupindex="{{index}}" | ||
data-index="{{actionIndex}}" | ||
data-value="{{item.value}}" | ||
bindtap="buttonTap" | ||
> | ||
{{item.text}} | ||
</view> | ||
</block> | ||
<slot name="{{actionItem}}" wx:else></slot> | ||
</view> | ||
<!-- 取消按钮 --> | ||
<view class="weui-actionsheet__action" wx:if="{{showCancel}}"> | ||
<view class="weui-actionsheet__cell" data-type="close" id="iosActionsheetCancel" bindtap="closeActionSheet">{{cancelText}}</view> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<view class="{{extClass}}"> | ||
<view class="{{extClass}} weui-cells__group {{outerClass}} {{childClass}}"> | ||
<view wx:if="{{title}}" class="weui-cells__title">{{title}}</view> | ||
<view class="weui-cells weui-cells_after-title {{checkboxCount > 0 && checkboxIsMulti ? 'weui-cells_checkbox' : ''}}"> | ||
<view class="weui-cells weui-cells_after-title weui-cells_form {{checkboxCount > 0 && checkboxIsMulti ? 'weui-cells_checkbox' : ''}}"> | ||
<slot></slot> | ||
</view> | ||
<view v-if="{{footer}}" class="weui-cells__tips">{{footer}}</view> | ||
<template v-else><slot name="footer"></slot></template> | ||
<view wx:if="{{footer}}" class="weui-cells__tips">{{footer}}</view> | ||
<slot name="footer" wx:else></slot> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@import "../weui-wxss/src/style/widget/weui-page/weui-form.wxss"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Component({ | ||
options: { | ||
addGlobalClass: true, | ||
multipleSlots: true, | ||
}, | ||
properties: { | ||
title: { // Msg 标题 | ||
type: String, | ||
value: '', | ||
}, | ||
subtitle: { // icon 的 type | ||
type: String, | ||
value: '' | ||
}, | ||
}, | ||
relations: { | ||
'../cells/cells': { | ||
type: 'descendant', | ||
linked(target) { | ||
if (!this.data.firstItem) { | ||
this.data.firstItem = target | ||
} | ||
if (target !== this.data.firstItem) { | ||
target.setOuterClass('weui-cells__group_wxss') | ||
} | ||
}, | ||
}, | ||
}, | ||
data: { | ||
firstItem: null | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<view class="weui-form"> | ||
<block wx:if="{{title || subtitle}}"> | ||
<view class="weui-form__text-area"> | ||
<view class="weui-form__title">{{title}}</view> | ||
<view class="weui-form__desc">{{subtitle}}</view> | ||
</view> | ||
</block> | ||
<block wx:else> | ||
<view class="weui-form__text-area"> | ||
<slot name="title"></slot> | ||
</view> | ||
</block> | ||
<view class="weui-form__control-area"> | ||
<view class="weui-cells__group weui-cells__group_form"> | ||
<slot></slot> | ||
</view> | ||
</view> | ||
<view class="weui-form__tips-area"> | ||
<slot name="tips"></slot> | ||
</view> | ||
<view class="weui-form__opr-area"> | ||
<slot name="button"></slot> | ||
</view> | ||
<view class="weui-form__tips-area"> | ||
<slot name="suffixtips"></slot> | ||
</view> | ||
<view class="weui-form__extra-area"> | ||
<view class="weui-footer"> | ||
<slot name="footer"></slot> | ||
</view> | ||
</view> | ||
</view> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.