...
|
...
|
@@ -2,10 +2,10 @@ |
|
|
<div :class="classes">
|
|
|
<slot name="tabs" v-bind:navList="navList">
|
|
|
<div :class="[prefixCls + '-bar']">
|
|
|
<span class="back">
|
|
|
<span class="back" @click="onBackClick">
|
|
|
<i class="iconfont fontcls"></i>
|
|
|
</span>
|
|
|
<span class="help">
|
|
|
<span class="help" @click="onHelpClick">
|
|
|
<i class="iconfont fontcls"></i>
|
|
|
</span>
|
|
|
<div>
|
...
|
...
|
@@ -26,7 +26,7 @@ |
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
name: "Tabs",
|
|
|
name: 'Tabs',
|
|
|
props: {
|
|
|
value: {
|
|
|
type: [String, Number]
|
...
|
...
|
@@ -34,7 +34,7 @@ export default { |
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
prefixCls: "yoho-tabs",
|
|
|
prefixCls: 'yoho-tabs',
|
|
|
navList: [],
|
|
|
activeKey: this.value
|
|
|
};
|
...
|
...
|
@@ -44,7 +44,7 @@ export default { |
|
|
return [`${this.prefixCls}`];
|
|
|
},
|
|
|
contentClasses() {
|
|
|
return [`yoho-tabs-pane`];
|
|
|
return ['yoho-tabs-pane'];
|
|
|
},
|
|
|
contentStyle() {
|
|
|
return [];
|
...
|
...
|
@@ -53,6 +53,7 @@ export default { |
|
|
methods: {
|
|
|
updateNav() {
|
|
|
this.navList = [];
|
|
|
console.log();
|
|
|
this.getTabs().forEach((pane, index) => {
|
|
|
this.navList.push({
|
|
|
label: pane.label,
|
...
|
...
|
@@ -60,7 +61,9 @@ export default { |
|
|
disabled: pane.disabled
|
|
|
});
|
|
|
|
|
|
if (!pane.currentName) pane.currentName = index;
|
|
|
if (!pane.currentName) {
|
|
|
pane.currentName = index;
|
|
|
}
|
|
|
|
|
|
if (index === 0) {
|
|
|
if (!this.activeKey) {
|
...
|
...
|
@@ -72,7 +75,7 @@ export default { |
|
|
this.updateStatus();
|
|
|
},
|
|
|
getTabs() {
|
|
|
return this.$children.filter(item => item.$options.name === "TabPane");
|
|
|
return this.$children.filter(item => item.$options.name === 'TabPane');
|
|
|
},
|
|
|
updateStatus() {
|
|
|
const tabs = this.getTabs();
|
...
|
...
|
@@ -83,19 +86,27 @@ export default { |
|
|
const nav = this.navList[index];
|
|
|
|
|
|
this.activeKey = nav.name;
|
|
|
this.$emit("input", nav.name);
|
|
|
this.$emit('input', nav.name);
|
|
|
},
|
|
|
tabCls(item) {
|
|
|
return [
|
|
|
"yoho-tab",
|
|
|
'yoho-tab',
|
|
|
{
|
|
|
[`yoho-tab-active`]: item.name === this.activeKey
|
|
|
['yoho-tab-active']: item.name === this.activeKey
|
|
|
}
|
|
|
];
|
|
|
},
|
|
|
onBackClick() {
|
|
|
this.$yoho.finishPage({});
|
|
|
},
|
|
|
onHelpClick() {
|
|
|
this.$yoho.goNewPage({
|
|
|
url: window.location.protocol + '//m.yohobuy.com/service/qaDetail?keyword=%E4%BC%98%E6%83%A0%E5%88%B8&sonId=181'
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
activeKey(val) {
|
|
|
activeKey() {
|
|
|
this.updateStatus();
|
|
|
},
|
|
|
value(val) {
|
...
|
...
|
@@ -103,7 +114,7 @@ export default { |
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
// this.updateNav();
|
|
|
this.updateNav();
|
|
|
}
|
|
|
};
|
|
|
</script>
|
...
|
...
|
@@ -120,7 +131,7 @@ $yoho-tab: yoho-tab; |
|
|
display: inline-block;
|
|
|
width: 200px;
|
|
|
height: 56px;
|
|
|
font-size: 12px;
|
|
|
font-size: 24px;
|
|
|
color: white;
|
|
|
border: 1px solid white;
|
|
|
box-sizing: border-box;
|
...
|
...
|
@@ -129,6 +140,10 @@ $yoho-tab: yoho-tab; |
|
|
line-height: 56px;
|
|
|
}
|
|
|
|
|
|
.#{$yoho-tab} + .#{$yoho-tab} {
|
|
|
border-left: none;
|
|
|
}
|
|
|
|
|
|
.#{$yoho-tab}s-bar {
|
|
|
width: 100%;
|
|
|
height: 90px;
|
...
|
...
|
@@ -136,12 +151,11 @@ $yoho-tab: yoho-tab; |
|
|
background: #3a3a3a;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
position: fixed;
|
|
|
z-index: 4;
|
|
|
}
|
|
|
|
|
|
.#{$yoho-tab}-active {
|
|
|
color: #444444;
|
|
|
color: #444;
|
|
|
background-color: white;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -156,13 +170,23 @@ $yoho-tab: yoho-tab; |
|
|
}
|
|
|
|
|
|
.back {
|
|
|
display: inline-block;
|
|
|
width: 90px;
|
|
|
height: 90px;
|
|
|
line-height: 90px;
|
|
|
position: absolute;
|
|
|
left: 20px;
|
|
|
left: 0;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
.help {
|
|
|
display: inline-block;
|
|
|
width: 90px;
|
|
|
height: 90px;
|
|
|
line-height: 90px;
|
|
|
position: absolute;
|
|
|
right: 20px;
|
|
|
right: 0;
|
|
|
text-align: center;
|
|
|
}
|
|
|
</style>
|
|
|
|
...
|
...
|
|