mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
Added: custom url rules
This commit is contained in:
parent
f6536b1dc2
commit
4010a09fe4
@ -115,13 +115,17 @@
|
|||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
label-position="top"
|
label-position="top"
|
||||||
|
:model="customLink"
|
||||||
|
ref="customLink"
|
||||||
|
:rules="rules"
|
||||||
>
|
>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="用占位符$url来表示url的位置"
|
label="用占位符$url来表示url的位置"
|
||||||
|
prop="value"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
class="align-center"
|
class="align-center"
|
||||||
v-model="customLink"
|
v-model="customLink.value"
|
||||||
:autofocus="true"
|
:autofocus="true"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -145,6 +149,13 @@ const { Menu, dialog, BrowserWindow } = remote
|
|||||||
export default {
|
export default {
|
||||||
name: 'setting-page',
|
name: 'setting-page',
|
||||||
data () {
|
data () {
|
||||||
|
const customLinkRule = (rule, value, callback) => {
|
||||||
|
if (!/\$url/.test(value)) {
|
||||||
|
return callback(new Error('必须含有$url'))
|
||||||
|
} else {
|
||||||
|
return callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
version: process.env.NODE_ENV === 'production' ? pkg.version : 'Dev',
|
version: process.env.NODE_ENV === 'production' ? pkg.version : 'Dev',
|
||||||
defaultActive: 'upload',
|
defaultActive: 'upload',
|
||||||
@ -152,7 +163,14 @@ export default {
|
|||||||
visible: false,
|
visible: false,
|
||||||
keyBindingVisible: false,
|
keyBindingVisible: false,
|
||||||
customLinkVisible: false,
|
customLinkVisible: false,
|
||||||
customLink: db.read().get('customLink').value() || '$url',
|
customLink: {
|
||||||
|
value: db.read().get('customLink').value() || '$url'
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
value: [
|
||||||
|
{ validator: customLinkRule, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
os: '',
|
os: '',
|
||||||
shortKey: {
|
shortKey: {
|
||||||
upload: db.read().get('shortKey.upload').value()
|
upload: db.read().get('shortKey.upload').value()
|
||||||
@ -238,12 +256,18 @@ export default {
|
|||||||
},
|
},
|
||||||
cancelCustomLink () {
|
cancelCustomLink () {
|
||||||
this.customLinkVisible = false
|
this.customLinkVisible = false
|
||||||
this.customLink = db.read().get('customLink').value() || '$url'
|
this.customLink.value = db.read().get('customLink').value() || '$url'
|
||||||
},
|
},
|
||||||
confirmCustomLink () {
|
confirmCustomLink () {
|
||||||
db.read().set('customLink', this.customLink).write()
|
this.$refs.customLink.validate((valid) => {
|
||||||
this.customLinkVisible = false
|
if (valid) {
|
||||||
this.$electron.ipcRenderer.send('updateCustomLink')
|
db.read().set('customLink', this.customLink.value).write()
|
||||||
|
this.customLinkVisible = false
|
||||||
|
this.$electron.ipcRenderer.send('updateCustomLink')
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteEnter: (to, from, next) => {
|
beforeRouteEnter: (to, from, next) => {
|
||||||
|
@ -111,6 +111,14 @@ export default {
|
|||||||
padding 8px 0
|
padding 8px 0
|
||||||
overflow-y auto
|
overflow-y auto
|
||||||
overflow-x hidden
|
overflow-x hidden
|
||||||
|
&::-webkit-scrollbar
|
||||||
|
width 8px
|
||||||
|
height 8px
|
||||||
|
&::-webkit-scrollbar-thumb
|
||||||
|
border-radius 4px
|
||||||
|
background #6f6f6f
|
||||||
|
&::&::-webkit-scrollbar-track
|
||||||
|
background-color transparent
|
||||||
.el-col
|
.el-col
|
||||||
height 150px
|
height 150px
|
||||||
position relative
|
position relative
|
||||||
|
Loading…
Reference in New Issue
Block a user