|
@@ -1,114 +1,114 @@
|
|
|
-<template>
|
|
|
- <div :class="[!bgmargin ? 'qz-timeline-bg' : 'qz-timeline-bgOne']">
|
|
|
- <div class="qz-timeline-layout">
|
|
|
- <div v-for="(item, index) in list" ref="ss" :key="'item' + index">
|
|
|
- <div class="qz-timeline-name" :class="[index === key ? 'qz-time-color1' : 'qz-time-color']">{{ item }}</div>
|
|
|
- <span class="circular" :class="[index === key ? 'qz-time-code1' : 'qz-time-code']" @click="qz_click_code({value: index, name: item})" />
|
|
|
- <div class="qz-timeline-divider" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-export default {
|
|
|
- props: {
|
|
|
- data: { type: Array, required: true },
|
|
|
- num: { type: Number, default: 0 },
|
|
|
- bgmargin: { type: Boolean, default: false }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- list: [],
|
|
|
- key: this.num
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- data: {
|
|
|
- handler(newV) {
|
|
|
- if (!newV) return
|
|
|
- this.list = newV
|
|
|
- },
|
|
|
- deep: true,
|
|
|
- immediate: true
|
|
|
- },
|
|
|
- num: {
|
|
|
- handler(newV) {
|
|
|
- this.key = newV
|
|
|
- document.getElementById('index').scrollLeft += 500
|
|
|
- // this.$refs.ss.scrollLeft = 300
|
|
|
- },
|
|
|
- deep: true
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 初始化
|
|
|
- timeline_init() {
|
|
|
- this.list = this.list.map(item => ({
|
|
|
- ...item,
|
|
|
- show: false
|
|
|
- }))
|
|
|
- },
|
|
|
- // 点击节点
|
|
|
- qz_click_code(val) {
|
|
|
- this.key = val.value
|
|
|
- this.$emit('update', val)
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="less" scoped>
|
|
|
-.qz-timeline-bgOne {
|
|
|
- min-width: max-content;
|
|
|
- margin: 0 30px 18px;
|
|
|
- text-align: center;
|
|
|
- padding-right: 30px;
|
|
|
-}
|
|
|
-.qz-timeline-bg {
|
|
|
- min-width: max-content;
|
|
|
- margin: 29px 30px 30px;
|
|
|
- text-align: center;
|
|
|
- padding-right: 30px;
|
|
|
-}
|
|
|
-.qz-timeline-layout {
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
-}
|
|
|
-.qz-timeline-divider {
|
|
|
- content: '';
|
|
|
- min-width: 100px;
|
|
|
- border: 1px solid #E5E5E5;
|
|
|
-}
|
|
|
-.qz-timeline-name {
|
|
|
- padding: 0 10px;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 12px;
|
|
|
- color: #444444;
|
|
|
- position: relative;
|
|
|
- top: 12px;
|
|
|
-}
|
|
|
-.circular {
|
|
|
- width: 10px;
|
|
|
- height: 10px;
|
|
|
- margin: 0 8px;
|
|
|
- display: inline-block;
|
|
|
- border: 1px solid #60AEFF;
|
|
|
- border-radius: 50%;
|
|
|
- position: relative;
|
|
|
- top: 12px;
|
|
|
- cursor: pointer;
|
|
|
-}
|
|
|
-.qz-time-code {
|
|
|
- background: #FFF;
|
|
|
-}
|
|
|
-.qz-time-code1 {
|
|
|
- background: #60AEFF;
|
|
|
-}
|
|
|
-.qz-time-color {
|
|
|
- color: #444;
|
|
|
-}
|
|
|
-.qz-time-color1 {
|
|
|
- color: #60AEFF;
|
|
|
-}
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <div :class="[!bgMargin ? 'timeline-bg' : 'timeline-bgOne']">
|
|
|
+ <div class="timeline-layout">
|
|
|
+ <div v-for="(item, index) in list" ref="ss" :key="'item' + index">
|
|
|
+ <div class="timeline-name" :class="[index === key ? 'time-color1' : 'time-color']">{{ item }}</div>
|
|
|
+ <span class="circular" :class="[index === key ? 'time-code1' : 'time-code']" @click="click_code({value: index, name: item})" />
|
|
|
+ <div class="timeline-divider" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ data: { type: Array, required: true },
|
|
|
+ num: { type: Number, default: 0 },
|
|
|
+ bgMargin: { type: Boolean, default: false }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: [],
|
|
|
+ key: this.num
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ data: {
|
|
|
+ handler(newV) {
|
|
|
+ if (!newV) return
|
|
|
+ this.list = newV
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
+ num: {
|
|
|
+ handler(newV) {
|
|
|
+ this.key = newV
|
|
|
+ document.getElementById('index').scrollLeft += 500
|
|
|
+ // this.$refs.ss.scrollLeft = 300
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 初始化
|
|
|
+ timeline_init() {
|
|
|
+ this.list = this.list.map(item => ({
|
|
|
+ ...item,
|
|
|
+ show: false
|
|
|
+ }))
|
|
|
+ },
|
|
|
+ // 点击节点
|
|
|
+ click_code(val) {
|
|
|
+ this.key = val.value
|
|
|
+ this.$emit('update', val)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.timeline-bgOne {
|
|
|
+ min-width: max-content;
|
|
|
+ margin: 0 30px 18px;
|
|
|
+ text-align: center;
|
|
|
+ padding-right: 30px;
|
|
|
+}
|
|
|
+.timeline-bg {
|
|
|
+ min-width: max-content;
|
|
|
+ margin: 29px 30px 30px;
|
|
|
+ text-align: center;
|
|
|
+ padding-right: 30px;
|
|
|
+}
|
|
|
+.timeline-layout {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.timeline-divider {
|
|
|
+ content: '';
|
|
|
+ min-width: 100px;
|
|
|
+ border: 1px solid #E5E5E5;
|
|
|
+}
|
|
|
+.timeline-name {
|
|
|
+ padding: 0 10px;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #444444;
|
|
|
+ position: relative;
|
|
|
+ top: 12px;
|
|
|
+}
|
|
|
+.circular {
|
|
|
+ width: 10px;
|
|
|
+ height: 10px;
|
|
|
+ margin: 0 8px;
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #60AEFF;
|
|
|
+ border-radius: 50%;
|
|
|
+ position: relative;
|
|
|
+ top: 12px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+.time-code {
|
|
|
+ background: #FFF;
|
|
|
+}
|
|
|
+.time-code1 {
|
|
|
+ background: #60AEFF;
|
|
|
+}
|
|
|
+.time-color {
|
|
|
+ color: #444;
|
|
|
+}
|
|
|
+.time-color1 {
|
|
|
+ color: #60AEFF;
|
|
|
+}
|
|
|
+</style>
|