wxc-cc
MinUI 小程序组件 - 水平垂直居中
Install
$ min install @minui/wxc-cc
Demos
默认示例
一个水平垂直居中的图片
<template>
<wxc-cc class="demo">
<image class="demo__pic" src="https://s10.mogucdn.com/mlcdn/c45406/171115_7eaee6469k5l0e1728j7aige52e81_352x352.png" mode="aspectFit"></image>
</wxc-cc>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-cc': '@minui/wxc-cc'
}
},
data: {},
methods: {}
}
</script>
<style>
.demo {
display: block;
width: 100%;
height: 400rpx;
background: #f2f2f2;
}
.demo__pic {
width: 200rpx;
height: 200rpx;
}
</style>
多元素
<template>
<wxc-cc class="demo">
<image class="demo__pic" src="https://s10.mogucdn.com/mlcdn/c45406/171115_7eaee6469k5l0e1728j7aige52e81_352x352.png" mode="aspectFit"></image>
<image class="demo__pic" src="https://s10.mogucdn.com/mlcdn/c45406/171109_871803cbeajedk3fabb59jl4idl1c_356x356.png" mode="aspectFit"></image>
</wxc-cc>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-cc': '@minui/wxc-cc'
}
},
data: {},
methods: {}
}
</script>
<style>
.demo {
display: block;
width: 100%;
height: 400rpx;
background: #f2f2f2;
}
.demo__pic {
width: 200rpx;
height: 200rpx;
margin: 15rpx;
}
</style>
图片加一换行的文字
<template>
<wxc-cc class="demo">
<view class="demo__wrapper">
<image class="demo__pic" src="https://s10.mogucdn.com/mlcdn/c45406/171115_7eaee6469k5l0e1728j7aige52e81_352x352.png" mode="aspectFit"></image>
<view class="demo__text">MinUI</view>
</view>
</wxc-cc>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-cc': '@minui/wxc-cc'
}
},
data: {},
methods: {}
}
</script>
<style>
.demo {
display: block;
width: 100%;
height: 400rpx;
background: #f2f2f2;
}
.demo__pic {
width: 200rpx;
height: 200rpx;
margin: 15rpx;
}
.demo__text {
text-align: center;
}
</style>
API
CC【props】
none
Link
地址 | |
---|---|
cc 组件文档 https://meili.github.io/min/docs/minui/index.html#cc | |
cc 组件源码 https://github.com/meili/minui/tree/master/packages/wxc-cc | |
MinUI 组件库 https://github.com/meili/minui |
Preview
ChangeLog
v1.0.0(2017-11-15)
- 初始版本