🚧 WIP: gallery db in progress

This commit is contained in:
PiEgg
2021-07-25 23:25:36 +08:00
parent 12cecc27e7
commit 76964ff1a5
48 changed files with 530 additions and 469 deletions

View File

@@ -8,31 +8,27 @@
</el-switch>
</div>
</template>
<script>
export default {
name: 'choose-pic-bed',
props: {
type: String,
label: String
},
data () {
return {
value: false
}
},
created () {
if (this.type === this.$db.get('picBed.current')) {
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'
@Component({
name: 'choose-pic-bed'
})
export default class extends Vue {
value = false
@Prop() type!: string
@Prop() label!: string
async created () {
const current = await this.getConfig<string>('picBed.current')
if (this.type === current) {
this.value = true
}
},
methods: {
choosePicBed (val) {
this.letPicGoSaveData({
'picBed.current': this.type,
'picBed.uploader': this.type
})
this.$emit('update:choosed', this.type)
}
}
choosePicBed (val: string) {
this.saveConfig({
'picBed.current': this.type,
'picBed.uploader': this.type
})
this.$emit('update:choosed', this.type)
}
}
</script>

View File

@@ -80,10 +80,10 @@ export default class extends Vue {
deep: true,
immediate: true
})
handleConfigChange (val: any) {
async handleConfigChange (val: any) {
this.ruleForm = Object.assign({}, {})
const config = this.$db.get(`picBed.${this.id}`)
if (val.length > 0) {
const config = await this.getConfig<IPicGoPluginConfig>(`picBed.${this.id}`)
if (val.length > 0 && config) {
this.configList = cloneDeep(val).map((item: any) => {
let defaultValue = item.default !== undefined
? item.default : item.type === 'checkbox'