1
This commit is contained in:
@@ -6,7 +6,7 @@ import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
type PlatformKey = 'zebra' | 'shopee' | 'rakuten' | 'amazon'
|
||||
|
||||
const props = defineProps<{ modelValue: boolean; platform?: PlatformKey }>()
|
||||
const emit = defineEmits(['update:modelValue', 'add'])
|
||||
const emit = defineEmits(['update:modelValue', 'add', 'refresh'])
|
||||
const visible = computed({ get: () => props.modelValue, set: v => emit('update:modelValue', v) })
|
||||
const curPlatform = ref<PlatformKey>(props.platform || 'zebra')
|
||||
const PLATFORM_LABEL: Record<PlatformKey, string> = {
|
||||
@@ -23,6 +23,9 @@ async function load() {
|
||||
const list = (res as any)?.data ?? res
|
||||
accounts.value = Array.isArray(list) ? list : []
|
||||
}
|
||||
|
||||
// 暴露方法供父组件调用
|
||||
defineExpose({ load })
|
||||
onMounted(load)
|
||||
|
||||
function switchPlatform(p: PlatformKey) {
|
||||
@@ -38,11 +41,12 @@ function formatDate(a: any) {
|
||||
async function onDelete(a: any) {
|
||||
const id = a?.id
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定删除账号 “${a?.name || a?.username || id}” 吗?`, '提示', { type: 'warning' })
|
||||
await ElMessageBox.confirm(`确定删除账号 "${a?.name || a?.username || id}" 吗?`, '提示', { type: 'warning' })
|
||||
} catch { return }
|
||||
await zebraApi.removeAccount(id)
|
||||
ElMessage({ message: '删除成功', type: 'success' })
|
||||
await load()
|
||||
emit('refresh') // 通知外层组件刷新账号列表
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user