123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <template>
- <view>
- <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($event, { tagId: id })"
- @error="bindError($event, { tagId: id })"
- @contact="bindContact($event, { tagId: id })"
- @opensetting="bindOpenSetting($event, { tagId: id })"
- @getuserinfo="bindGetUserInfo($event, { tagId: id })"
- @getphonenumber="bindGetPhoneNumber($event, { tagId: id })"
- @launchapp="bindLaunchApp($event, { tagId: id })"
- >
- {{ text }}
- <slot></slot>
- </van-button>
- </view>
- </template>
- <script module="utils" lang="wxs" src="@/node_modules/@vant/weapp/dist/wxs/utils.wxs"></script>
- <script>
- import { VantComponent } from '../common/component';
- import { link } from '../mixins/link';
- import { button } from '../mixins/button';
- import { openType } from '../mixins/open-type';
- export default {
- data() {
- return {
- isFirst: '',
- isLast: '',
- id: '',
- lang: '',
- openType: '',
- businessId: '',
- sessionFrom: '',
- appParameter: '',
- sendMessageImg: '',
- sendMessagePath: '',
- showMessageCard: '',
- sendMessageTitle: ''
- };
- },
- mixins: [link, button, openType],
- '../goods-action/index': {
- type: 'ancestor',
- name: 'goods-action',
- current: 'goods-action-button'
- },
- props: {
- text: String,
- color: String,
- loading: Boolean,
- disabled: Boolean,
- plain: Boolean,
- type: {
- type: String,
- default: 'danger'
- }
- },
- methods: {
- onClick(event, _dataset) {
- /* ---处理dataset begin--- */
- this.handleDataset(event, _dataset);
- /* ---处理dataset end--- */
- this.$emit('click', event.detail);
- this.jumpLink();
- },
- updateStyle() {
- if (this.parent == null) {
- return;
- }
- const { children = [] } = this.parent;
- const { length } = children;
- const index = children.indexOf(this);
- this.setData({
- isFirst: index === 0,
- isLast: index === length - 1
- });
- },
- bindError(e, _dataset) {
- /* ---处理dataset begin--- */
- this.handleDataset(e, _dataset);
- /* ---处理dataset end--- */
- console.log('占位:函数 bindError 未声明');
- },
- bindContact(e, _dataset) {
- /* ---处理dataset begin--- */
- this.handleDataset(e, _dataset);
- /* ---处理dataset end--- */
- console.log('占位:函数 bindContact 未声明');
- },
- bindOpenSetting(e, _dataset) {
- /* ---处理dataset begin--- */
- this.handleDataset(e, _dataset);
- /* ---处理dataset end--- */
- console.log('占位:函数 bindOpenSetting 未声明');
- },
- bindGetUserInfo(e, _dataset) {
- /* ---处理dataset begin--- */
- this.handleDataset(e, _dataset);
- /* ---处理dataset end--- */
- console.log('占位:函数 bindGetUserInfo 未声明');
- },
- bindGetPhoneNumber(e, _dataset) {
- /* ---处理dataset begin--- */
- this.handleDataset(e, _dataset);
- /* ---处理dataset end--- */
- console.log('占位:函数 bindGetPhoneNumber 未声明');
- },
- bindLaunchApp(e, _dataset) {
- /* ---处理dataset begin--- */
- this.handleDataset(e, _dataset);
- /* ---处理dataset end--- */
- console.log('占位:函数 bindLaunchApp 未声明');
- }
- }
- };
- </script>
- <style>
- @import './index.css';
- </style>
|