1
|
<template>
|
1
|
<template>
|
2
|
- <Select v-model="_fieldModel" @on-change="selectChange" clearable>
|
2
|
+ <Select v-model="brandId" @on-change="selectChange" clearable>
|
3
|
<Option :value="-1">全部</Option>
|
3
|
<Option :value="-1">全部</Option>
|
4
|
<Option v-for="option in optionList" :value="option.brandId" :key="option.brandId">
|
4
|
<Option v-for="option in optionList" :value="option.brandId" :key="option.brandId">
|
5
|
{{option.brandName}}
|
5
|
{{option.brandName}}
|
|
@@ -14,43 +14,27 @@ |
|
@@ -14,43 +14,27 @@ |
14
|
export default {
|
14
|
export default {
|
15
|
name: 'SelectBrand',
|
15
|
name: 'SelectBrand',
|
16
|
props: {
|
16
|
props: {
|
17
|
- fieldLabel: {
|
|
|
18
|
- type: String
|
|
|
19
|
- },
|
|
|
20
|
-
|
|
|
21
|
- fieldModel: {
|
|
|
22
|
- type: [String, Number]
|
|
|
23
|
- },
|
|
|
24
|
-
|
|
|
25
|
- labelSpan: {
|
|
|
26
|
- type: [String, Number],
|
|
|
27
|
- default: 6
|
|
|
28
|
- },
|
|
|
29
|
-
|
|
|
30
|
- fieldSpan: {
|
|
|
31
|
- type: [String, Number],
|
|
|
32
|
- default: 18
|
17
|
+ value: {
|
|
|
18
|
+ type: Number,
|
|
|
19
|
+ default: 0
|
33
|
}
|
20
|
}
|
34
|
},
|
21
|
},
|
35
|
data() {
|
22
|
data() {
|
36
|
return {
|
23
|
return {
|
|
|
24
|
+ brandId: this.value,
|
37
|
optionList: []
|
25
|
optionList: []
|
38
|
- }
|
|
|
39
|
- },
|
|
|
40
|
- computed: {
|
|
|
41
|
- _fieldModel() {
|
|
|
42
|
- return this.fieldModel;
|
|
|
43
|
- }
|
26
|
+ };
|
44
|
},
|
27
|
},
|
45
|
created() {
|
28
|
created() {
|
46
|
const err_msg = '获取品牌列表失败。';
|
29
|
const err_msg = '获取品牌列表失败。';
|
|
|
30
|
+
|
47
|
service.getBrand().then((res) => {
|
31
|
service.getBrand().then((res) => {
|
48
|
let code = _.get(res, 'data.code');
|
32
|
let code = _.get(res, 'data.code');
|
49
|
|
33
|
|
50
|
- if(code === 200) {
|
|
|
51
|
- return this.optionList = res.data.data;
|
34
|
+ if (code === 200) {
|
|
|
35
|
+ this.optionList = res.data.data;
|
|
|
36
|
+ return;
|
52
|
}
|
37
|
}
|
53
|
-
|
|
|
54
|
return this.$Message.error(err_msg);
|
38
|
return this.$Message.error(err_msg);
|
55
|
}, (error) => {
|
39
|
}, (error) => {
|
56
|
this.$Message.error(error.message);
|
40
|
this.$Message.error(error.message);
|
|
@@ -58,10 +42,10 @@ |
|
@@ -58,10 +42,10 @@ |
58
|
},
|
42
|
},
|
59
|
methods: {
|
43
|
methods: {
|
60
|
selectChange(val) {
|
44
|
selectChange(val) {
|
61
|
- this.$emit('on-change', val);
|
45
|
+ this.$emit('input', val);
|
62
|
}
|
46
|
}
|
63
|
}
|
47
|
}
|
64
|
- }
|
48
|
+ };
|
65
|
</script>
|
49
|
</script>
|
66
|
|
50
|
|
67
|
<style lang="scss" scoped>
|
51
|
<style lang="scss" scoped>
|