order.vue
1.87 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<template>
<ul class="order-navs clearfix">
<template v-for="item in config">
<simple v-if="(item.type || 'simple') === 'simple'" :txt="item.txt" :val="item.val">
</simple>
<updown v-if="item.type === 'updown'" :txt="item.txt" :vals="item.val">
</updown>
</template>
</ul>
</template>
<script>
const bus = require('common/vue-bus');
const simple = require('./order/simple.vue');
const updown = require('./order/updown.vue');
module.exports = {
props: {
/**
* order 配置
* @type {Array} [{type, txt, val}]
* type: 类型 simple, updown
* txt: 文字,
* val: 值
*/
config: Array,
// 初始值 可以进行双向绑定
val: String
},
components: {
simple,
updown
},
methods: {},
watch: {
val: function(newVal, oldVal) {
bus.$emit('order.change', {
val: newVal,
ref: this._uid
});
}
}
};
</script>
<style>
@import "../../../scss/common/color";
.order-navs {
list-style: none;
margin: 0;
padding: 25px 0;
color: $grey;
background-color: #fff;
border-bottom: 1px solid #eee;
}
.order-item {
position: relative;
display: block;
width: 25%;
float: left;
text-align: center;
&:after {
content: "|";
position: absolute;
right: 0;
color: $grey;
font-size: 28px;
}
&:last-of-type:after {
display: none;
}
.order-name {
font-size: 28px;
}
.order-icon {
position: relative;
margin-left: 10px;
.icon-sort-up,
.icon-sort-down {
position: absolute;
left: 0;
top: 2px;
}
}
&.active {
color: $black;
}
}
</style>