Browse Source

完成删除主题的功能

pull/9/head
ruibaby 6 years ago
parent
commit
1cc799e505
  1. 7
      src/api/theme.js
  2. 15
      src/views/interface/ThemeList.vue

7
src/api/theme.js

@ -32,4 +32,11 @@ themeApi.active = theme => {
})
}
themeApi.delete = key => {
return service({
url: `${baseUrl}/${key}`,
method: 'delete'
})
}
export default themeApi

15
src/views/interface/ThemeList.vue

@ -26,7 +26,13 @@
<a-button type="primary" v-if="activatedTheme == theme.key" disabled>已启用</a-button>
<a-button type="primary" @click="activeTheme(theme.key)" v-else>启用</a-button>
<a-button @click="optionModal(theme.key)" v-if="activatedTheme == theme.key">设置</a-button>
<a-popconfirm :title="'确定删除【'+theme.properties.name+'】主题?'" @confirm="deleteTheme(theme.key)" okText="确定" cancelText="取消" v-else>
<a-popconfirm
:title="'确定删除【' + theme.properties.name + '】主题?'"
@confirm="deleteTheme(theme.key)"
okText="确定"
cancelText="取消"
v-else
>
<a-button type="dashed">删除</a-button>
</a-popconfirm>
</a-button-group>
@ -72,8 +78,11 @@ export default {
this.loadThemes()
})
},
deleteTheme(theme) {
this.$message.success('删除' + theme)
deleteTheme(key) {
themeApi.delete(key).then(response => {
this.$message.success('删除成功!')
this.loadThemes()
})
}
}
}

Loading…
Cancel
Save