// components/button/button.ts
Component({
  behaviors: ['wx://form-field-button'],
  lifetimes: {
    attached() {
      const mode = this.data.block ? 'block' : 'line';
      const index = this.data.index;
      this.setData({ 
        src: `../../assets/bg/button-${mode}-${index}.bg.png`,
        className: this.data.block ? 'block' : `line-${index}`,
      })
    }
  },
  properties: {
    block: { type: Boolean, value: false },
    index: { type: Number, value: 1 },
  },
  data: {
    src: '',
  },
  methods: {}
})