<view class="container">
<view class="title">普通按钮</view>
<view class="button-wrap" wx:for="{{types}}" wx:for-item="type" wx:key="key">
<wxc-button size="normal" type="{{type}}" value="{{type}}"></wxc-button>
</view>
</view>
<view class="container">
<view class="title">镂空按钮</view>
<view class="button-wrap" wx:for="{{types}}" wx:for-item="type" wx:key="key">
<wxc-button plain="{{true}}" size="normal" type="{{type}}" value="{{type}}"></wxc-button>
</view>
</view>
<view class="container">
<view class="title">小按钮</view>
<view class="button-small-wrap">
<wxc-button size="small" type="beauty" value="small"></wxc-button>
</view>
<view class="button-small-wrap">
<wxc-button plain="{{true}}" size="small" type="beauty" value="small"></wxc-button>
</view>
</view>
<view class="container">
<view class="title">大按钮带 loading 状态</view>
<view class="button-large-wrap">
<wxc-button size="large" type="beauty" loading="{{true}}" value="large button"></wxc-button>
</view>
<view class="button-large-wrap">
<wxc-button plain="{{true}}" size="large" type="beauty" loading="{{true}}" value="large button"></wxc-button>
</view>
<view class="container">
<view class="title">自定义按钮</view>
<view class="button-small-wrap">
<wxc-button type="beauty" btnStyle="min-width: 66rpx;padding: 0;border-radius: 66rpx"><wxc-icon color="#fff" size="36" type="cart"></wxc-icon></wxc-button>
</view>
<view class="button-small-wrap">
<wxc-button btnStyle="{{style}}">预约直播 <wxc-icon color="#fff" type="arrow-right"></wxc-icon></wxc-button>
</view>
<view class="button-small-wrap">
<wxc-button type="beauty" btnStyle="width: 312rpx;">立即换购</wxc-button>
</view>
</view>
<view class="container">
<view class="title">表单</view>
<view class="button-small-wrap">
<wxc-button bindsubmit="onSubmit" type="beauty" btnStyle="width: 312rpx;">按钮</wxc-button>
</view>
</view>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-button': '@minui/wxc-button',
'wxc-icon': '@minui/wxc-icon'
}
},
data: {
types: [
'beauty', 'selection', 'disabled',
'danger', 'success', 'secondary',
'primary', 'info', 'dark', 'warning'
],
style: 'width: 222rpx;background: #ff9300;border-radius: 66rpx;color: #fff;'
},
/** note: 在 wxp 文件或者页面文件中请去掉 methods 包装 */
methods: {
console.log(e.detail.formId)
}
}
</script>
<style>
.container {
width: 100%;
padding-top: 20rpx;
background: #fff;
text-align: center;
}
.container:after {
display: block;
content: " ";
clear:both;
visibility:hidden;
height:0;
}
.title {
line-height: 50rpx;
margin-left:35rpx;
margin-bottom:10rpx;
text-align:left;
font-weight: bold;
font-size: 30rpx;
color: #333;
}
.button-wrap {
margin:0 0 10rpx 35rpx;
float: left;
}
.button-large-wrap {
margin-bottom: 10rpx;
}
.button-small-wrap {
margin:0 0 10rpx 30rpx;
float: left;
}
</style>
- 小程序组件系统中组件是隔离的,组件外层套
form
标签时两者是不通的,现在组件中内置 form
标签用于获取 formId
。 - 小程序组件系统中组件是隔离的,所以提交表单时无法用
form
表单获取输入框中的值,只能单独获取。
v1.0.1(2018-6-5)
v1.0.0(2018-02-26)