index.vue 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <uni-shadow-root class="vant-goods-action-button-index"><van-button :id="id" :button-id="buttonId" :lang="lang" :type="type" :size="size" :color="color" :plain="plain" :loading="loading" :disabled="disabled" :open-type="openType" :class="utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])" custom-class="van-goods-action-button__inner custom-class" :custom-style="customStyle" :business-id="businessId" :session-from="sessionFrom" :app-parameter="appParameter" :send-message-img="sendMessageImg" :send-message-path="sendMessagePath" :show-message-card="showMessageCard" :send-message-title="sendMessageTitle" @click="onClick" @error="onError" @contact="onContact" @opensetting="onOpenSetting" @getuserinfo="onGetUserInfo" @agreeprivacyauthorization="onAgreePrivacyAuthorization" @getRealTimePhoneNumber="onGetRealTimePhoneNumber" @getphonenumber="onGetPhoneNumber" @launchapp="onLaunchApp">
  3. {{ text }}
  4. <slot></slot>
  5. </van-button></uni-shadow-root>
  6. </template>
  7. <wxs src="../wxs/utils.wxs" module="utils"></wxs>
  8. <script>
  9. import VanButton from '../button/index.vue'
  10. global['__wxVueOptions'] = {components:{'van-button': VanButton}}
  11. global['__wxRoute'] = 'vant/goods-action-button/index'
  12. import { VantComponent } from '../common/component';
  13. import { useParent } from '../common/relation';
  14. import { button } from '../mixins/button';
  15. import { link } from '../mixins/link';
  16. VantComponent({
  17. mixins: [link, button],
  18. relation: useParent('goods-action'),
  19. props: {
  20. text: String,
  21. color: String,
  22. size: {
  23. type: String,
  24. value: 'normal',
  25. },
  26. loading: Boolean,
  27. disabled: Boolean,
  28. plain: Boolean,
  29. type: {
  30. type: String,
  31. value: 'danger',
  32. },
  33. customStyle: {
  34. type: String,
  35. value: '',
  36. },
  37. },
  38. methods: {
  39. onClick(event) {
  40. this.$emit('click', event.detail);
  41. this.jumpLink();
  42. },
  43. updateStyle() {
  44. if (this.parent == null) {
  45. return;
  46. }
  47. const { index } = this;
  48. const { children = [] } = this.parent;
  49. this.setData({
  50. isFirst: index === 0,
  51. isLast: index === children.length - 1,
  52. });
  53. },
  54. },
  55. });
  56. export default global['__wxComponents']['vant/goods-action-button/index']
  57. </script>
  58. <style platform="mp-weixin">
  59. @import '../common/index.css';.vant-goods-action-button-index{flex:1}.van-goods-action-button{--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(to right,#ffd01e,#ff8917));--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(to right,#ff6034,#ee0a24));--button-default-height:var(--goods-action-button-height,40px);--button-line-height:var(--goods-action-button-line-height,20px);--button-plain-background-color:var(--goods-action-button-plain-color,#fff);--button-border-width:0;display:block}.van-goods-action-button--first{--button-border-radius:999px 0 0 var(--goods-action-button-border-radius,999px);margin-left:5px}.van-goods-action-button--last{--button-border-radius:0 999px var(--goods-action-button-border-radius,999px) 0;margin-right:5px}.van-goods-action-button--first.van-goods-action-button--last{--button-border-radius:var(--goods-action-button-border-radius,999px)}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{font-weight:var(--font-weight-bold,500)!important;width:100%}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
  60. </style>