index.vue 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <uni-shadow-root class="vant-goods-action-button-index"><van-button :id="id" :lang="lang" :type="type" :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" :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" @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. loading: Boolean,
  23. disabled: Boolean,
  24. plain: Boolean,
  25. type: {
  26. type: String,
  27. value: 'danger',
  28. },
  29. },
  30. methods: {
  31. onClick(event) {
  32. this.$emit('click', event.detail);
  33. this.jumpLink();
  34. },
  35. updateStyle() {
  36. if (this.parent == null) {
  37. return;
  38. }
  39. const { index } = this;
  40. const { children = [] } = this.parent;
  41. this.setData({
  42. isFirst: index === 0,
  43. isLast: index === children.length - 1,
  44. });
  45. },
  46. },
  47. });
  48. export default global['__wxComponents']['vant/goods-action-button/index']
  49. </script>
  50. <style platform="mp-weixin">
  51. @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}}
  52. </style>