Skip to content

Commit

Permalink
fix(popup, picker, date-picker, tab-picker, selector, cashier): extra…
Browse files Browse the repository at this point in the history
…ct props to mixins
  • Loading branch information
xxyan0205 committed Dec 12, 2018
1 parent 917bffb commit 16431b6
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 139 deletions.
29 changes: 17 additions & 12 deletions components/cashier/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@

<script>import Popup from '../popup'
import PopupTitlebar from '../popup/title-bar'
import popupMixin from '../popup/mixins'
import popupTitleBarMixin from '../popup/mixins/title-bar'
import Captcha from '../captcha'
import Button from '../button'
import Icon from '../icon'
Expand All @@ -128,6 +130,8 @@ import Channel from './channel'
export default {
name: 'md-cashier',
mixins: [popupMixin, popupTitleBarMixin],
components: {
[Popup.name]: Popup,
[PopupTitlebar.name]: PopupTitlebar,
Expand All @@ -139,10 +143,6 @@ export default {
},
props: {
value: {
type: Boolean,
default: false,
},
channels: {
type: Array,
default() {
Expand All @@ -160,14 +160,6 @@ export default {
type: Number,
default: 0,
},
title: {
type: String,
default: '\u652f\u4ed8', // 支付
},
describe: {
type: String,
default: '',
},
paymentTitle: {
type: String,
default: '\u652f\u4ed8\u91d1\u989d\u0028\u5143\u0029', // 支付金额
Expand All @@ -192,6 +184,19 @@ export default {
type: String,
default: '\u66f4\u591a\u652f\u4ed8\u65b9\u5f0f', // 更多支付方式
},
title: {
default: '\u652f\u4ed8', // 支付
},
// Mixin Props
// value: {
// type: Boolean,
// default: false,
// },
// describe: {
// type: String,
// default: '',
// },
},
data() {
Expand Down
53 changes: 29 additions & 24 deletions components/date-picker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<script>
import Picker from '../picker'
import pickerMixin from '../picker/mixins'
import {
toObject,
toArray,
Expand Down Expand Up @@ -58,15 +59,13 @@ const TYPE_METHODS = {
export default {
name: 'md-date-picker',
mixins: [pickerMixin],
components: {
[Picker.name]: Picker
},
props: {
value: {
type: Boolean,
default: false
},
type: { // date, time, datetime, custom
type: String,
default: 'date'
Expand Down Expand Up @@ -115,26 +114,32 @@ export default {
type: [Function, String],
default: ''
},
title: {
type: String
},
describe: {
type: String
},
okText: {
type: String
},
cancelText: {
type: String
},
isView: {
type: Boolean,
default: false
},
maskClosable: {
type: Boolean,
default: true,
}
// Mixin Props
// value: {
// type: Boolean,
// default: false
// },
// title: {
// type: String
// },
// describe: {
// type: String
// },
// okText: {
// type: String
// },
// cancelText: {
// type: String
// },
// isView: {
// type: Boolean,
// default: false
// },
// maskClosable: {
// type: Boolean,
// default: true,
// }
},
data () {
Expand Down
63 changes: 34 additions & 29 deletions components/picker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,22 @@
<script>import Popup from '../popup'
import PopTitleBar from '../popup/title-bar'
import PickerColumn from './picker-column'
import pickerMixin from './mixins'
import cascadePicker from './cascade'
import {compareObjects, extend} from '../_util'
export default {
name: 'md-picker',
mixins: [pickerMixin],
components: {
[Popup.name]: Popup,
[PopTitleBar.name]: PopTitleBar,
[PickerColumn.name]: PickerColumn,
},
props: {
value: {
type: Boolean,
default: false,
},
data: {
type: Array,
default() {
Expand Down Expand Up @@ -109,30 +108,36 @@ export default {
type: Boolean,
default: false,
},
isView: {
type: Boolean,
default: false,
},
title: {
type: String,
default: '',
},
describe: {
type: String,
default: '',
},
okText: {
type: String,
default: '确认',
},
cancelText: {
type: String,
default: '取消',
},
maskClosable: {
type: Boolean,
default: true,
},
// Mixin Props
// value: {
// type: Boolean,
// default: false,
// },
// isView: {
// type: Boolean,
// default: false,
// },
// title: {
// type: String,
// default: '',
// },
// describe: {
// type: String,
// default: '',
// },
// okText: {
// type: String,
// default: '确认',
// },
// cancelText: {
// type: String,
// default: '取消',
// },
// maskClosable: {
// type: Boolean,
// default: true,
// },
},
data() {
Expand Down Expand Up @@ -267,7 +272,7 @@ export default {
// reset picker by snapshot
this.$nextTick(() => {
this.$_resetPickerColumn()
this.refresh()
this.column.refresh()
})
},
$_onPickerChange(columnIndex, itemIndex, values) {
Expand Down
18 changes: 18 additions & 0 deletions components/picker/mixins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import popupMixin from '../../popup/mixins'
import popupTitleBarMixin from '../../popup/mixins/title-bar'

export default {
mixins: [popupMixin, popupTitleBarMixin],
props: {
isView: {
type: Boolean,
default: false,
},
okText: {
default: '确认',
},
cancelText: {
default: '取消',
},
},
}
28 changes: 16 additions & 12 deletions components/popup/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,18 @@
</template>

<script>import Transition from '../transition'
import popupMixin from './mixins'
export default {
name: 'md-popup',
mixins: [popupMixin],
components: {
'md-transition': Transition,
},
props: {
value: {
type: Boolean,
default: false,
},
hasMask: {
type: Boolean,
default: true,
},
maskClosable: {
type: Boolean,
default: true,
},
position: {
type: String,
default: 'center',
Expand Down Expand Up @@ -90,6 +81,19 @@ export default {
return ''
},
},
// Mixin Props
// value: {
// type: Boolean,
// default: false,
// },
// hasMask: {
// type: Boolean,
// default: true,
// },
// maskClosable: {
// type: Boolean,
// default: true,
// },
},
data() {
Expand Down
16 changes: 16 additions & 0 deletions components/popup/mixins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default {
props: {
value: {
type: Boolean,
default: false,
},
hasMask: {
type: Boolean,
default: true,
},
maskClosable: {
type: Boolean,
default: true,
},
},
}
20 changes: 20 additions & 0 deletions components/popup/mixins/title-bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default {
props: {
title: {
type: String,
default: '',
},
describe: {
type: String,
default: '',
},
okText: {
type: String,
default: '',
},
cancelText: {
type: String,
default: '',
},
},
}
39 changes: 22 additions & 17 deletions components/popup/title-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,31 @@
</div>
</template>

<script>export default {
<script>import titleBarMixin from './mixins/title-bar'
export default {
name: 'md-popup-title-bar',
mixins: [titleBarMixin],
props: {
title: {
type: String,
default: '',
},
describe: {
type: String,
default: '',
},
okText: {
type: String,
default: '',
},
cancelText: {
type: String,
default: '',
},
// Mixin Props
// title: {
// type: String,
// default: '',
// },
// describe: {
// type: String,
// default: '',
// },
// okText: {
// type: String,
// default: '',
// },
// cancelText: {
// type: String,
// default: '',
// },
},
methods: {
Expand Down
Loading

0 comments on commit 16431b6

Please sign in to comment.