<template>
    <div class="edit-view">
        <div class="edit-view__content-wrapper">
            <div class="edit-view__content-section" v-loading="loading">
                <el-input v-model="param" placeholder="输入参数"></el-input>
                <el-button @click="clean('user', null, param)">user</el-button>
                <el-button @click="clean('user')">all user</el-button>
                <el-button @click="clean('userMy', null, param)">userMy</el-button>
                <el-button @click="clean('userMy')">all userMy</el-button>
                <el-button @click="clean('collection')">all collection</el-button>
                <el-button @click="clean('recommend')">all recommend</el-button>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            loading: false,
            param: null
        };
    },
    methods: {
        clean(name, stringParam, longParam) {
            this.loading = true;
            this.$http
                .post('/cache/clear', { name, stringParam, longParam })
                .then(res => {
                    this.loading = false;
                    this.$message.success('成功');
                })
                .catch(e => {
                    this.loading = false;
                    this.$message.error(e.error || '失败');
                });
        }
    }
};
</script>
<style lang="less" scoped>
.el-input {
    width: 300px;
    margin-right: 20px;
    margin-bottom: 20px;
}
.el-button {
    margin-bottom: 20px;
}
</style>