|
62 | 62 | 'jsonUrl', |
63 | 63 | 'id' |
64 | 64 | ], |
65 | | - //created() { |
66 | | - // if(this.jsonUrl ) |
67 | | - // this.$http.get('/api/goodDetail/' + this.$route.params.id) |
68 | | - // .then(res => { |
69 | | - // let code = res.data.code; |
70 | | - // if (code === 0) { |
71 | | - // this.good = res.data.result; |
72 | | - // this.updateRoute = '/update/' + this.good.id; |
73 | | - // this.good.price = price(this.good.price); |
74 | | - // } else { |
75 | | - // this.$message({ |
76 | | - // type: 'error', |
77 | | - // message: res.data.msg |
78 | | - // }); |
79 | | - // } |
80 | | - // }).catch(error => { |
81 | | - |
82 | | - // }) |
83 | | - // }, |
| 65 | + created() { |
| 66 | + if(this.jsonUrl.includes("update")) { |
| 67 | + this.$http.get('/api/goodDetail/' + this.$route.params.id) |
| 68 | + .then(res => { |
| 69 | + let code = res.data.code; |
| 70 | + if (code === 0) { |
| 71 | + this.good = res.data.result; |
| 72 | + this.good.price = price(this.good.price); |
| 73 | + } else { |
| 74 | + this.$message({ |
| 75 | + type: 'error', |
| 76 | + message: res.data.msg |
| 77 | + }); |
| 78 | + } |
| 79 | + }).catch(error => { |
| 80 | + }) |
| 81 | + } |
| 82 | + }, |
84 | 83 | methods: { |
85 | 84 | submit: function() { |
86 | 85 | this.good.img = this.$refs.imgUpload.img; |
|
0 commit comments