mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(GoodsActionButton):样式升级为圆角风格 (#2096)
This commit is contained in:
parent
147080bf54
commit
1a3332d36c
@ -1,3 +1,41 @@
|
|||||||
|
@import '../common/style/var.less';
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.van-goods-action-button {
|
||||||
|
height: 36px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
font-size: @font-size-md !important;
|
||||||
|
line-height: 34px !important;
|
||||||
|
border: none !important;
|
||||||
|
|
||||||
|
&--first {
|
||||||
|
display: block !important;
|
||||||
|
width: auto !important;
|
||||||
|
margin-left: 5px;
|
||||||
|
border-top-left-radius: 18px !important;
|
||||||
|
border-bottom-left-radius: 18px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--last {
|
||||||
|
display: block !important;
|
||||||
|
width: auto !important;
|
||||||
|
margin-right: 5px;
|
||||||
|
border-top-right-radius: 18px !important;
|
||||||
|
border-bottom-right-radius: 18px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--warning {
|
||||||
|
background: linear-gradient(to right, #ffd01e, #ff8917);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--danger {
|
||||||
|
background: linear-gradient(to right, #ff6034, #ee0a24);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 321px) {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -6,7 +6,13 @@ import { Weapp } from 'definitions/weapp';
|
|||||||
|
|
||||||
VantComponent({
|
VantComponent({
|
||||||
mixins: [link, button, openType],
|
mixins: [link, button, openType],
|
||||||
|
relation: {
|
||||||
|
type: 'ancestor',
|
||||||
|
name: 'goods-action',
|
||||||
|
linked(parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
text: String,
|
text: String,
|
||||||
color: String,
|
color: String,
|
||||||
@ -18,10 +24,31 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted: function() {
|
||||||
|
this.updateStyle();
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onClick(event: Weapp.Event) {
|
onClick(event: Weapp.Event) {
|
||||||
this.$emit('click', event.detail);
|
this.$emit('click', event.detail);
|
||||||
this.jumpLink();
|
this.jumpLink();
|
||||||
|
},
|
||||||
|
updateStyle() {
|
||||||
|
const parent = this.parent;
|
||||||
|
const { children = [] } = parent;
|
||||||
|
const index = children.indexOf(this);
|
||||||
|
const length = children.length;
|
||||||
|
let isFirst = false, isLast = false;
|
||||||
|
if ( index === 0 ) {
|
||||||
|
isFirst = true;
|
||||||
|
}
|
||||||
|
if (index === length - 1) {
|
||||||
|
isLast = true;
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
isFirst,
|
||||||
|
isLast
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
<van-button
|
<van-button
|
||||||
square
|
square
|
||||||
id="{{ id }}"
|
id="{{ id }}"
|
||||||
@ -8,7 +9,7 @@
|
|||||||
loading="{{ loading }}"
|
loading="{{ loading }}"
|
||||||
disabled="{{ disabled }}"
|
disabled="{{ disabled }}"
|
||||||
open-type="{{ openType }}"
|
open-type="{{ openType }}"
|
||||||
custom-class="custom-class"
|
custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast }]) }}"
|
||||||
business-id="{{ businessId }}"
|
business-id="{{ businessId }}"
|
||||||
session-from="{{ sessionFrom }}"
|
session-from="{{ sessionFrom }}"
|
||||||
app-parameter="{{ appParameter }}"
|
app-parameter="{{ appParameter }}"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
bindgetphonenumber="bindGetPhoneNumber"
|
bindgetphonenumber="bindGetPhoneNumber"
|
||||||
bindlaunchapp="bindLaunchApp"
|
bindlaunchapp="bindLaunchApp"
|
||||||
>
|
>
|
||||||
<view class="van-goods-action-icon__content van-hairline--right">
|
<view class="van-goods-action-icon__content">
|
||||||
<van-icon
|
<van-icon
|
||||||
wx:if="{{ icon }}"
|
wx:if="{{ icon }}"
|
||||||
size="20px"
|
size="20px"
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.theme(background-color, '@white');
|
.theme(background-color, '@white');
|
||||||
|
|
||||||
&--safe {
|
&--safe {
|
||||||
|
@ -1,6 +1,19 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
|
|
||||||
VantComponent({
|
VantComponent({
|
||||||
|
relation: {
|
||||||
|
type: 'descendant',
|
||||||
|
name: 'goods-action-button',
|
||||||
|
linked(child) {
|
||||||
|
this.children.push(child);
|
||||||
|
},
|
||||||
|
unlinked(child) {
|
||||||
|
this.children = this.children.filter((item) => item !== child);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
this.children = [];
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
safeAreaInsetBottom: {
|
safeAreaInsetBottom: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user