tab-editor-new.vue
1.79 KB
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
64
<template>
<div>
<Input :value="tabName" @input="onUpdateTitle" placeholder="Tab名称"/>
<Input :value="channelCode" @input="onUpdateCode" placeholder="资源位Code码"/>
<Input :value="productPool" @input="onUpdateProductPool" placeholder="商品池ID"/>
</div>
</template>
<script>
import util from '@/libs/util'
export default {
props: ['value'],
data() {
return {
pagename: util.getUrlQueryString(this.value, 'pagename') || 'home',
tabName: util.getUrlQueryString(this.value, 'tabName'),
channelCode: util.getUrlQueryString(this.value, 'channelCode'),
productPool: util.getUrlQueryString(this.value, 'productPool'),
link: util.getLink(this.value) || 'https://m.yohobuy.com/',
}
},
watch: {
value(newVal) {
this.pagename = util.getUrlQueryString(this.value, 'pagename') || 'home';
this.tabName = util.getUrlQueryString(this.value, 'tabName');
this.channelCode = util.getUrlQueryString(this.value, 'channelCode');
this.productPool = util.getUrlQueryString(this.value, 'productPool');
this.link = util.getLink(this.value) || 'https://m.yohobuy.com/';
}
},
methods: {
onUpdateTitle(val) {
this.tabName = val;
this.$emit('input', this.getUrl());
},
onUpdateCode(val) {
this.channelCode = val;
this.$emit('input', this.getUrl());
},
onUpdateProductPool(val) {
this.productPool = val;
this.$emit('input', this.getUrl());
},
getUrl() {
let params = new URLSearchParams();
params.append('pagename', this.pagename);
params.append('tabName', this.tabName);
params.append('channelCode', this.channelCode);
params.append('productPool', this.productPool);
return `${this.link}?${params}`
}
}
}
</script>
<style>
</style>