0.0.129 • Published 1 year ago

mp-components v0.0.129

Weekly downloads
1
License
MIT
Repository
-
Last release
1 year ago
npm install mp-components

Components

mp-nav-bar

mp-tab

mp-ellipsis

mp-popup

mp-dropdown-menu

mp-dropdown-menu-item

mp-button

mp-button-group

mp-box

mp-dots

mp-pk-card

mp-pk-progress-bar

mp-image

mp-nav-bar-home

mp-line

mp-text-line

mp-tab-panel

mp-tab-panel-item

mp-expand

mp-action-sheet

mp-expand-enhanced

mp-collapse

mp-nav-bar

  • properties

bg: String、 zIndex: Number、 custom: Boolean

  • events

height

  • slots

left、title、 default

Tip: If the custom property is true, the left and title slots are invalid

Demo

<mp-nav-bar custom="{{true}}">
	<view slot="left">back</view>
	<view slot="title">title</view>
	<view>custom</view>
</mp-nav-bar>

mp-ellipsis

  • properties

content: String、 contentClass: String、 contentStyle: String、 rows: Number、 size: String、 lineHeight: String、ellipsisColor: String、forceShowSlot: Boolean, forceShowSlotPosition: 'end' | 'suffix', isAsync: Boolean, offset: Number

  • slot

default

Demo

<mp-ellipsis content="what???" rows="{{2}}">
	<view>Slot</view>
</mp-ellipsis>

mp-tab

  • properties

data: Array、 labelField: String | null、 active: Number、 height: String、gap: String、size: String、activeSize: String、color: String、 activeColor: String、 activeLineHeight: String、 activeLineColor: String、 border: String、 borderColor: String、 justifyBetween: Boolean、itemStyle: String、activeItemStyle: String、 startSize: Number、endSize: Number => font-size animation scale from size to start and then end

  • events

change

Demo

<comp data="{{['tab1', 'tab2']}}" height="120rpx" active="{{curTab}}" itemClass="item" catch:change='onChange'></comp>

mp-popup

  • properties

visible: Boolean、 bg: String、 maskClosable: Boolean、 duration: Number、 type: String、 contentClass: String

type -> bottom、top、left、right、center、center-scale

  • events

open、opened、close、 closed

  • slot

default

mp-dropdown-menu

  • properties

duration: Number、 bg: String、 maskClosable: Boolean

  • events

open、opened、close、 closed、 change

  • methods

close

  • slot

default

mp-dropdown-menu-item

  • slot

default、 title

<mp-dropdown-menu maskClosable="{{true}}" catch:change="onMenuChange" catch:close="close" catch:closed="closed"
                  catch:open="open" catch:opened="opened">
	<mp-dropdown-menu-item>
		<view slot="title" class="menu-item">One</view>
		<view style="background: #ffffff;">Content</view>
	</mp-dropdown-menu-item>
	<mp-dropdown-menu-item>
		<view slot="title" class="menu-item">Two</view>
		<view style="background: #ffffff;">Content2</view>
	</mp-dropdown-menu-item>
	<mp-dropdown-menu-item>
		<view slot="title" class="menu-item">Three</view>
		<view style="background: #ffffff;">Content3</view>
	</mp-dropdown-menu-item>
</mp-dropdown-menu>
.menu-item {
	width: 100%;
	padding: 20rpx 0;
}

mp-button

  • properties

disabled: Boolean、 padding: String、 loading: Boolean、 loadingSize: Boolean、 dark: Boolean、 ghostDark: Boolean、 ghostLight: Boolean

  • event

tap

<mp-button bindtap="handleTap">
	填充按钮
</mp-button>

Effect

mp-button-group

  • properties

gap: String

<mp-button-group>
	<mp-button ghostLight>了解详情</mp-button>
	<mp-button ghostDark>立即订购</mp-button>
</mp-button-group>

mp-box

  • properties

ratio: Number

mp-dots

  • properties

count: Number、current: Number、 radius: String、 gap: String、color: String、activeColor: String、 activeWidth: String、width: String、height: String、radius: String

  • event

change

mp-pk-card

  • properties

bg: String、bgOpacity: Number、 images: Array、 gap: String、 deg: Number、 pLeft: String

  • slot

left、right

  • events

offset

demo

<view style="height: 500rpx;">
	<mp-pk-card deg="{{-10}}">
		<view slot="left" style="height: 100%; width: 100%; color: red; display: flex; align-items: flex-end;">
			Left
		</view>
		<view slot="right"
		      style="height: 100%; width: 100%; color: red; display: flex; align-items: flex-end; justify-content: flex-end;">
			Right
		</view>
	</mp-pk-card>
</view>

mp-pk-progress-bar

  • properties

height: String、 radius: String、 bg: String、 chunkWidth: String、 value: String、 left: String、 right: String、 deg: Number

mp-image

  • properties

src: String、 lazy: Boolean、 mode: String、 radius: String、bg: String

mp-nav-bar-home

  • properties

bg: String, iconStyle: String, backStyle: String, homeStyle: String, backIcon: String, homeIcon: String, homePath: String, homePathIsTabBar: Boolean, duration: Number, customBackEvent: Boolean

  • events

height

back

<!-- bg, iconStyle, backStyle, homeStyle, backIcon, homeIcon, homePath, homePathIsTabBar, duration => default value -->

<mp-nav-bar-home>
	<view>Title</view>
</mp-nav-bar-home>

	<!-- with default value -->
<mp-nav-bar-home
	bg="rgba(255, 255, 255, 1)"
	iconStyle="margin-left: 32rpx;"
	backStyle="width: 56rpx; height: 56rpx;"
	homeStyle="width: 40rpx; height: 40rpx;"
	backIcon="https://source-1259320891.cos.ap-shanghai.myqcloud.com/medias/nav-back.png"
	homeIcon="https://source-1259320891.cos.ap-shanghai.myqcloud.com/medias/home-icon.png"
	homePath=""
	homePathIsTabBar="{{true}}"
	duration="{{400}}"
>
	<view>Title</view>
</mp-nav-bar-home>

mp-line

  • properties

top: Boolean, right: Boolean, bottom: Boolean, left: Boolean, radius: String, color: String, shadow: String

<view style="width: 50%; margin: 0 auto;">
	<mp-box>
		<mp-line top right bottom left color="blue" shadow="0 8rpx 16rpx 0 blue" radius="8rpx">
			<mp-box>
				<view bindtap="log">???</view>
			</mp-box>
		</mp-line>
	</mp-box>
</view>
<view style="height: 60rpx;"></view>
<mp-line top right bottom left color="blue" shadow="box-shadow: 0 8rpx 16rpx 0 rgba(0, 0, 0, 0.06)">
	<mp-box>
		<view bindtap="log">???</view>
	</mp-box>
</mp-line>

<view style="height: 20rpx;"></view>
<view style="border: 1rpx solid purple; border-radius: 8rpx;">
	<mp-box></mp-box>
</view>
<view style="height: 20rpx;"></view>

<mp-line top color="red">
	<mp-box ratio="{{3/4}}">
		<view>???</view>
	</mp-box>
</mp-line>
<view style="height: 20rpx;"></view>
<mp-line left color="blue">
	<mp-box ratio="{{3/4}}">
		<view>???</view>
	</mp-box>
</mp-line>
<view style="height: 20rpx;"></view>
<mp-line bottom color="yellow">
	<mp-box ratio="{{3/4}}">
		<view>???</view>
	</mp-box>
</mp-line>
<view style="height: 20rpx;"></view>
<mp-line right color="green">
	<mp-box ratio="{{3/4}}">
		<view>???</view>
	</mp-box>
</mp-line>

mp-text-line

  • properties

line: Number, text: String

mp-tab-panel、mp-tab-panel-item

有些场景只用到左右切换页面,并且不支持手势切换,可以用这个组件
  • properties

height: String、 current: Number、 duration: Number

<mp-tab-panel current="{{current}}">
	<mp-tab-panel-item>One</mp-tab-panel-item>
	<mp-tab-panel-item>Two</mp-tab-panel-item>
	<mp-tab-panel-item>Three</mp-tab-panel-item>
</mp-tab-panel>

mp-expand

  • properties

custom: Boolean 可以自定义 默认显示的内容

direction: "top"、"bottom"、"left"、"right"; default is "top"

duration: Number; default is 300ms

iconBg: String

bg: String

  • events

toggle

  • slot

default 默认显示的内容 custom 自定义显示的内容 (properties 传入 custom="{{true}}" 时生效)

<view class="add-feed-box">
	<mp-expand catch:toggle="toggle">
		<view class="add-feed-icon-2 {{expandVisible ? 'expand' : ''}}">
			<image class="icon-item" mode="aspectFill"
			       src="https://sit-app-h5-1306106726.cos.ap-shanghai.myqcloud.com/prod/feed-image-icon.png"></image>
			<image class="icon-item" mode="aspectFill"
			       src="https://sit-app-h5-1306106726.cos.ap-shanghai.myqcloud.com/prod/feed-video-icon.png"></image>
			<view class="icon-item"></view>
		</view>
	</mp-expand>
</view>
Page({
	data: {
		expandVisible: false
	},
	toggle({detail}) {
		this.setData({expandVisible: detail.visible})
	}
})
.add-feed-icon-2 {
    width: 100rpx;
    height: 100rpx;
    border-radius: 50rpx;
    transition: height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.32);
    overflow: hidden;
}

.add-feed-icon-2.expand {
    height: 364rpx;
}

.icon-item {
    width: 100rpx;
    height: 100rpx;
    border-radius: 50rpx;
    margin-bottom: 32rpx;
}

Effect

mp-action-sheet

  • properties

zIndex: Number, topBg: String, bottomBg: String, gap: String

  • slot

top、bottom

<mp-action-sheet>
	<view slot="top" class="initial">
		<view style="padding: 40rpx 0 0 0; display: flex; align-items: center; justify-content: space-between;">
			<view>
				<block wx:if="{{visible}}">
					<text>微信用户昵称:杨苏州</text>
				</block>
			</view>
			<image style="width: 56rpx; height: 56rpx;"
			       src="https://sit-app-h5-1306106726.cos.ap-shanghai.myqcloud.com/prod/clear-screen-icon.png"
			       bind:tap="toggle2"></image>
		</view>
		<mp-collapse visible="{{visible}}">
			<mp-expand-enhanced style="color: #ffffff;" text="{{text}}" expand="{{expand}}" initialLine="2">
				<view slot="left">
					<button>话题</button>
					<button>地址</button>
				</view>
				<view slot="right" style="background: #6E1013; padding: 4rpx 2rpx;" bind:tap="toggle">
					{{expand ? '收起' : '展开'}}
				</view>
			</mp-expand-enhanced>
		</mp-collapse>
	</view>
	<view slot="bottom" class="initial">
		<Inp />
	</view>
</mp-action-sheet>
Page({
	data: {
		expand: false,
		visible: true,
		text: '嘿嘿嘿好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊嘿嘿嘿好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊好多好多好饭好歌词的哈吃不饱啊咋办啊',
		src: 'https://qa-data.roxmotor.com/ccms-service/1747543957778604032-video/1718171849640.mp4?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDKTLyKPDk11kBOL1QZR2MfneEYcPvA9tM%26q-sign-time%3D1718187731%3B1718191331%26q-key-time%3D1718187731%3B1718191331%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3Ddb47f518df071526bf861b7c5af48d8f6e5fffb1',
	},
	toggle: function () {
		this.setData({expand: !this.data.expand})
	},
	toggle2: function () {
		this.setData({visible: !this.data.visible})
	},
	onLoad: function (options) {

	},
});

mp-expand-enhanced

  • properties

expand: Boolean, text: String, initialLine: Number, gap: String, position: String, initExpandVisible: Boolean

position 可选值 "start"、"center"、"end",默认 "end"

  • slot

left、right、default

mp-collapse

  • properties

visible: Boolean, duration: Number

  • slot

default

mp-fade-slide-up

  • properties

absolute: Boolean, fixed: Boolean, position: String, visible: Boolean, duration: Number, offset: String, shadow: String, radius: String, bg: String

  • slot

default

0.0.128

1 year ago

0.0.129

1 year ago

0.0.127

2 years ago

0.0.126

2 years ago

0.0.125

2 years ago

0.0.124

2 years ago

0.0.109

2 years ago

0.0.108

2 years ago

0.0.117

2 years ago

0.0.116

2 years ago

0.0.115

2 years ago

0.0.114

2 years ago

0.0.119

2 years ago

0.0.118

2 years ago

0.0.113

2 years ago

0.0.112

2 years ago

0.0.111

2 years ago

0.0.110

2 years ago

0.0.120

2 years ago

0.0.123

2 years ago

0.0.122

2 years ago

0.0.121

2 years ago

0.0.106

2 years ago

0.0.105

2 years ago

0.0.107

2 years ago

0.0.104

2 years ago

0.0.103

2 years ago

0.0.102

2 years ago

0.0.101

2 years ago

0.0.100

2 years ago

0.0.96

2 years ago

0.0.97

2 years ago

0.0.98

2 years ago

0.0.99

2 years ago

0.0.95

2 years ago

0.0.93

2 years ago

0.0.94

2 years ago

0.0.92

2 years ago

0.0.84

3 years ago

0.0.85

2 years ago

0.0.86

2 years ago

0.0.87

2 years ago

0.0.88

2 years ago

0.0.89

2 years ago

0.0.80

3 years ago

0.0.81

3 years ago

0.0.82

3 years ago

0.0.83

3 years ago

0.0.78

3 years ago

0.0.79

3 years ago

0.0.90

2 years ago

0.0.91

2 years ago

0.0.73

3 years ago

0.0.74

3 years ago

0.0.75

3 years ago

0.0.76

3 years ago

0.0.77

3 years ago

0.0.71

3 years ago

0.0.72

3 years ago

0.0.70

3 years ago

0.0.62

3 years ago

0.0.63

3 years ago

0.0.64

3 years ago

0.0.65

3 years ago

0.0.66

3 years ago

0.0.67

3 years ago

0.0.68

3 years ago

0.0.69

3 years ago

0.0.60

3 years ago

0.0.61

3 years ago

0.0.59

3 years ago

0.0.51

3 years ago

0.0.52

3 years ago

0.0.54

3 years ago

0.0.55

3 years ago

0.0.56

3 years ago

0.0.57

3 years ago

0.0.58

3 years ago

0.0.50

3 years ago

0.0.48

3 years ago

0.0.49

3 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.43

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.46

3 years ago

0.0.47

3 years ago

0.0.37

3 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.30

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.29

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.1

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

1.3.9

9 years ago

1.3.8

9 years ago

1.3.7

9 years ago

1.3.6

9 years ago

1.3.5

9 years ago

1.3.4

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.16

10 years ago

1.0.14

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago