-
Notifications
You must be signed in to change notification settings - Fork 1
/
Server.vue
63 lines (60 loc) · 1.28 KB
/
Server.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
<div class="section">
<div class="title">私有部署</div>
<div class="content">
<div class="item">
<span class="name">启用私有部署</span>
<r-switch v-model="enablePrivate"/>
</div>
<div class="item private-server">
<span class="name">私有服务器地址</span>
<input
type="text"
name="server-config"
:readonly="!enablePrivate"
v-model.lazy="privateUrl"
placeholder="例: https://www.rishiqing.com"
/>
</div>
</div>
</div>
</template>
<script>
import rswitch from './Rswitch.vue'
export default {
name: "server",
props: {
config: {
type: Object,
default:() => ({})
}
},
model: {
prop: 'config',
event: 'change'
},
data() {
return {
enablePrivate: this.config.enablePrivate,
privateUrl: this.config.privateUrl,
}
},
components: {
'r-switch' : rswitch
},
mounted() {
this.$watch(() => ({
enablePrivate: this.enablePrivate,
privateUrl: this.privateUrl,
}), (newVal) => {
this.$emit('change', newVal)
})
this.$watch('config', (newVal) => {
this.enablePrivate = newVal.enablePrivate
this.privateUrl = newVal.privateUrl
}, { deep: true })
},
}
</script>
<style scoped>
</style>