|
@@ -3,8 +3,7 @@
|
|
|
<el-row class="order_tab">
|
|
|
<el-col :span="15">
|
|
|
<div class="tab_list">
|
|
|
- <div class="tab_item" @click="changeTabs(i)" :class="{'tab_item_ac':tab_ac==i?true:false}"
|
|
|
- v-for="(item,i) in tab_list" :key="i">
|
|
|
+ <div class="tab_item" @click="changeTabs(i)" :class="{'tab_item_ac':tab_ac==i?true:false}" v-for="(item,i) in tab_list" :key="i">
|
|
|
<span>{{item.name}}</span>
|
|
|
<div class="tab_line"></div>
|
|
|
</div>
|
|
@@ -13,39 +12,52 @@
|
|
|
</el-row>
|
|
|
<el-row class="content">
|
|
|
<el-col :span="24">
|
|
|
- <component :is="activeName"></component>
|
|
|
+ <component v-if="renderComponent" :is="activeName"></component>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import voiceSetting from './settingComponents/voiceSetting.vue';
|
|
|
-import deliverySetting from './settingComponents/deliverySetting.vue';
|
|
|
+import voiceSetting from "./settingComponents/voiceSetting.vue";
|
|
|
+import deliverySetting from "./settingComponents/deliverySetting.vue";
|
|
|
export default {
|
|
|
- name: 'HelloWorld',
|
|
|
- data () {
|
|
|
+ name: "HelloWorld",
|
|
|
+ data() {
|
|
|
return {
|
|
|
- msg: 'Welcome to Your Vue.js App',
|
|
|
+ msg: "Welcome to Your Vue.js App",
|
|
|
tab_list: [
|
|
|
- {name: '自动接单/语音设置', index: 0},
|
|
|
- {name: '推荐/屏蔽运力', index: 1}
|
|
|
+ { name: "自动接单/语音设置", index: 0 },
|
|
|
+ { name: "推荐/屏蔽运力", index: 1 },
|
|
|
],
|
|
|
tab_ac: 0,
|
|
|
- activeName: 'voiceSetting'
|
|
|
- }
|
|
|
+ activeName: "voiceSetting",
|
|
|
+ renderComponent: true,
|
|
|
+ };
|
|
|
},
|
|
|
components: {
|
|
|
voiceSetting,
|
|
|
- deliverySetting
|
|
|
+ deliverySetting,
|
|
|
},
|
|
|
methods: {
|
|
|
+ forceRerender() {
|
|
|
+ // 从 DOM 中删除 my-component 组件
|
|
|
+ this.renderComponent = false;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // 在 DOM 中添加 my-component 组件
|
|
|
+ this.renderComponent = true;
|
|
|
+ });
|
|
|
+ },
|
|
|
changeTabs(i) {
|
|
|
+ if (i === this.tab_ac) {
|
|
|
+ this.forceRerender();
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.tab_ac = i;
|
|
|
- this.activeName = i == 0 ? 'voiceSetting' : 'deliverySetting';
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ this.activeName = i == 0 ? "voiceSetting" : "deliverySetting";
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
@@ -54,7 +66,7 @@ export default {
|
|
|
.order_tab {
|
|
|
width: 100%;
|
|
|
height: 74px;
|
|
|
- background: #FFF;
|
|
|
+ background: #fff;
|
|
|
|
|
|
.tab_list {
|
|
|
width: 100%;
|
|
@@ -69,7 +81,7 @@ export default {
|
|
|
margin-right: 56px;
|
|
|
font-size: 16px;
|
|
|
font-weight: 500;
|
|
|
- color: #B1B1B1;
|
|
|
+ color: #b1b1b1;
|
|
|
position: relative;
|
|
|
text-align: center;
|
|
|
cursor: pointer;
|
|
@@ -77,17 +89,17 @@ export default {
|
|
|
.tab_line {
|
|
|
width: 58px;
|
|
|
height: 6px;
|
|
|
- background: #FFF;
|
|
|
+ background: #fff;
|
|
|
border-radius: 3px;
|
|
|
margin: 15px auto 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.tab_item_ac {
|
|
|
- color: #FC7200;
|
|
|
+ color: #fc7200;
|
|
|
|
|
|
.tab_line {
|
|
|
- background: #FC7200;
|
|
|
+ background: #fc7200;
|
|
|
}
|
|
|
}
|
|
|
}
|