mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-11 10:39:56 +08:00
✨ Feature: support multiple config (#1016)
This commit is contained in:
@@ -7,6 +7,18 @@
|
||||
ref="form"
|
||||
size="mini"
|
||||
>
|
||||
<el-form-item
|
||||
:label="$T('UPLOADER_CONFIG_NAME')"
|
||||
required
|
||||
prop="_configName"
|
||||
>
|
||||
<el-input
|
||||
type="input"
|
||||
v-model="ruleForm._configName"
|
||||
:placeholder="$T('UPLOADER_CONFIG_PLACEHOLDER')"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<!-- dynamic config -->
|
||||
<el-form-item
|
||||
v-for="(item, index) in configList"
|
||||
:label="item.alias || item.name"
|
||||
@@ -115,10 +127,12 @@ export default class extends Vue {
|
||||
}
|
||||
|
||||
async handleConfig (val: IPicGoPluginConfig[]) {
|
||||
this.ruleForm = Object.assign({}, {})
|
||||
const config = await this.getConfig<IPicGoPluginConfig>(this.getConfigType())
|
||||
const config = await this.getCurConfigFormData()
|
||||
const configId = this.$route.params.configId
|
||||
this.ruleForm = Object.assign({}, config)
|
||||
if (val.length > 0) {
|
||||
this.configList = cloneDeep(val).map((item) => {
|
||||
if (!configId) return item
|
||||
let defaultValue = item.default !== undefined
|
||||
? item.default
|
||||
: item.type === 'checkbox'
|
||||
@@ -138,6 +152,12 @@ export default class extends Vue {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async getCurConfigFormData () {
|
||||
const configId = this.$route.params.configId
|
||||
const curTypeConfigList = await this.getConfig<IStringKeyMap[]>(`uploader.${this.id}.configList`) || []
|
||||
return curTypeConfigList.find(i => i._id === configId) || {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='stylus'>
|
||||
|
||||
Reference in New Issue
Block a user