<style lang="less">

</style>

<template>
    <Modal v-model="editModal" :loading="loading">
        <p slot="header">
            <Icon type="information-circled"></Icon>
            <span>修改</span>
        </p>
        <div>
            <Form ref="form" :label-width="80">
                <FormItem label="分类">
                    <Input v-model="classify" />
                </FormItem>
            </Form>
        </div>
        <div slot="footer">
            <Button type="primary" @click="submit">确定</Button>
        </div>
    </Modal>
</template>

<script>
export default {
    name: 'edit',
    data() {
        return {
            loading: true,
            id: this.row.id,
            classify: this.row.classify,
            editModal: false
        }
    },
    watch: {
        row() {
            this.classify = this.row.classify;
            this.id = this.row.id;
        },
        editShow() {
            this.editModal = this.editShow;
        },
        editModal() {
            if (!this.editModal) {
                this.$emit("close");
            }
        }
    },
    props: {
        editClassify: Array,
        editShow: Boolean,
        row: Object
    },
    methods: {
        submit() {
            this.axios.post("/product_classify/store", {
                id: this.id,
                classify: this.classify
            }).then((res) => {
                this.$emit("close", {classify: this.classify});
                this.loading = false;
            });
        }
    }
};
</script>
