From b8bd964a2b5efbf60f3ad83e14d3028cdd48f831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Mon, 19 Aug 2024 18:20:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/custom.ts | 13 +++++++++++++ src/store/modules/custom.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/api/custom.ts create mode 100644 src/store/modules/custom.ts diff --git a/src/api/custom.ts b/src/api/custom.ts new file mode 100644 index 00000000..26af9682 --- /dev/null +++ b/src/api/custom.ts @@ -0,0 +1,13 @@ +import request from '@/utils/request'; + +class CustomAPI { + /** 分类品牌查询接口*/ + static getCustominit() { + return request({ + url: `diyapi/custominit`, + method: 'post', + }); + } +} + +export default CustomAPI; diff --git a/src/store/modules/custom.ts b/src/store/modules/custom.ts new file mode 100644 index 00000000..5b58d086 --- /dev/null +++ b/src/store/modules/custom.ts @@ -0,0 +1,29 @@ +import { ref } from 'vue'; +import { defineStore } from 'pinia'; + +export const DataSourceStore = defineStore('dataSource', () => { + interface product_list { + id: number; + name: string; + }; + // 上传是否需要调接口判断 + const is_data_source_api = ref(false); + // 数据源 + const data_source_list = ref([]); + // 存储上传分类列表 + const set_data_source = (category: product_list[], brand: product_list[]) => { + data_source_list.value = category; + is_data_source_api.value = true; + }; + // 如果为false 则转为true + const set_is_shop_api = (bool: boolean) => { + is_data_source_api.value = bool; + }; + + return { + data_source_list, + is_data_source_api, + set_data_source, + set_is_shop_api, + }; +});