<style lang="less">

</style>

<template>
    <Modal v-model="show" :loading="loading" :closable="false">
        <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,
            opt: {},
            classify: '',
            show: false
        }
    },
    methods: {
        submit() {
            if (!this.classify) {
                this.show = true;
                return;
            }
            if (this.opt.classifys && this.opt.classifys.length > 0) {
                this.opt.classifys.forEach((classify, i) => {
                    if (classify == this.classify) {
                        // this.opt.classifys[i] = this.classify;
                    }
                })
            }
            this.axios.post("/product_classify/store", {
                classify: this.classify
            }).then((res) => {
                this.show = false;
                this.loading = false;
            });
        }
    }
};
</script>
