| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- Component({
- externalClasses: ['custom-class'],
- options: {
- multipleSlots: true,
- },
- properties: {
- // 圆角大小
- round: {
- type: String,
- value: 'none',
- },
- // 外边距
- margin: {
- type: Boolean,
- value: false,
- }
- },
- data: {
- styles: '',
- },
- methods: {
- },
- attached() {
- const styles: string[] = []
- if (this.data.margin) {
- styles.push('margin-left:24rpx')
- styles.push('margin-right:24rpx')
- }
- switch (this.data.round) {
- case 'normal': {
- styles.push('border-radius:20rpx')
- break;
- }
- case 'small': {
- styles.push('border-radius:10rpx')
- break;
- }
- }
- this.setData({
- styles: styles.join(';')
- })
- }
- })
|