重置问题修复
This commit is contained in:
parent
dce85e2e57
commit
3e38bdb3e9
@ -37,7 +37,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
|
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
|
||||||
<!--<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>-->
|
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@ -45,7 +45,16 @@
|
|||||||
<script>
|
<script>
|
||||||
import {createBrand, getBrand, updateBrand} from '@/api/brand'
|
import {createBrand, getBrand, updateBrand} from '@/api/brand'
|
||||||
import SingleUpload from '@/components/Upload/singleUpload'
|
import SingleUpload from '@/components/Upload/singleUpload'
|
||||||
|
const defaultBrand={
|
||||||
|
bigPic: '',
|
||||||
|
brandStory: '',
|
||||||
|
factoryStatus: 0,
|
||||||
|
firstLetter: '',
|
||||||
|
logo: '',
|
||||||
|
name: '',
|
||||||
|
showStatus: 0,
|
||||||
|
sort: 0
|
||||||
|
};
|
||||||
export default {
|
export default {
|
||||||
name: 'BrandDetail',
|
name: 'BrandDetail',
|
||||||
components:{SingleUpload},
|
components:{SingleUpload},
|
||||||
@ -57,16 +66,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
brand: {
|
brand:null,
|
||||||
bigPic: '',
|
|
||||||
brandStory: '',
|
|
||||||
factoryStatus: 0,
|
|
||||||
firstLetter: '',
|
|
||||||
logo: '',
|
|
||||||
name: '',
|
|
||||||
showStatus: 0,
|
|
||||||
sort: 0
|
|
||||||
},
|
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: '请输入品牌名称', trigger: 'blur'},
|
{required: true, message: '请输入品牌名称', trigger: 'blur'},
|
||||||
@ -86,6 +86,8 @@
|
|||||||
getBrand(this.$route.query.id).then(response => {
|
getBrand(this.$route.query.id).then(response => {
|
||||||
this.brand = response.data;
|
this.brand = response.data;
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
this.brand = Object.assign({},defaultBrand);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -110,6 +112,7 @@
|
|||||||
} else {
|
} else {
|
||||||
createBrand(this.brand).then(response => {
|
createBrand(this.brand).then(response => {
|
||||||
this.$refs[formName].resetFields();
|
this.$refs[formName].resetFields();
|
||||||
|
this.brand = Object.assign({},defaultBrand);
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '提交成功',
|
message: '提交成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -131,6 +134,7 @@
|
|||||||
},
|
},
|
||||||
resetForm(formName) {
|
resetForm(formName) {
|
||||||
this.$refs[formName].resetFields();
|
this.$refs[formName].resetFields();
|
||||||
|
this.brand = Object.assign({},defaultBrand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user