Commit 970f72b3 authored by 徐一鸣's avatar 徐一鸣

the-list组件样式修复

parent 944d2339
<template> <template>
<div class="top_list apaas_scroll" @mouseenter="mouseenter" @mouseleave="mouseleave"> <div
class="the_list apaas_scroll"
@mouseenter="mouseenter"
@mouseleave="mouseleave"
>
<ul> <ul>
<li class="item" v-for="(item ,idx) in data" :key="idx"> <li class="item" v-for="(item, idx) in data" :key="idx">
<span :class="idx==0?'one':idx==1?'two':idx==2?'three':'lis'" class="pm">{{idx+1}}.</span> <span
<img :src="item.img" alt /> :class="
<p class="name">{{item.name}}</p> idx == 0 ? 'one' : idx == 1 ? 'two' : idx == 2 ? 'three' : 'lis'
<p class="init">{{item.init}}</p> "
<span class="count">{{getCount(item.count)}}</span> class="pm"
>
{{ idx + 1 }}.
</span>
<img :src="item.img" />
<p class="text_clip">
<span class="name">{{ item.name }}</span><br>
<span class="init">{{ item.init }}</span>
</p>
<span class="count">{{ getCount(item.count) }}</span>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -18,15 +31,9 @@ export default { ...@@ -18,15 +31,9 @@ export default {
data: { data: {
type: Array, type: Array,
default() { default() {
return [ return [];
{ },
name: "123", },
init: "122222",
count: 1080
}
];
}
}
}, },
data() { data() {
return {}; return {};
...@@ -34,7 +41,7 @@ export default { ...@@ -34,7 +41,7 @@ export default {
methods: { methods: {
getCount(val) { getCount(val) {
let a = val + ""; let a = val + "";
// console.log((val + "").length);
if (a.length > 3) { if (a.length > 3) {
return a.substr(0, 1) + "," + a.substr(1); return a.substr(0, 1) + "," + a.substr(1);
} else { } else {
...@@ -42,6 +49,7 @@ export default { ...@@ -42,6 +49,7 @@ export default {
} }
}, },
autoScroll() { autoScroll() {
return;
if (this.timer) { if (this.timer) {
clearInterval(this.timer); clearInterval(this.timer);
} }
...@@ -70,37 +78,36 @@ export default { ...@@ -70,37 +78,36 @@ export default {
}, },
mouseleave() { mouseleave() {
this.autoScroll(); this.autoScroll();
} },
}, },
mounted() { mounted() {
this.autoScroll(); this.autoScroll();
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
this.autoScroll(); this.autoScroll();
}); });
},
destroyed() {
if (this.timer) {
clearInterval(this.timer);
} }
},
}; };
</script> </script>
<style scoped> <style scoped>
.top_list { .the_list {
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
} }
li {
list-style: none;
}
.item { .item {
height: 50px; height: 50px;
position: relative; display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
} }
.item img { .item > .pm {
height: 35px; flex-shrink: 0;
width: 35px;
border-radius: 50%;
margin-left: 15px;
margin-top: 7px;
}
.item .pm {
width: 14px; width: 14px;
height: 12px; height: 12px;
font-family: Arial-Black; font-family: Arial-Black;
...@@ -109,38 +116,37 @@ li { ...@@ -109,38 +116,37 @@ li {
letter-spacing: 0px; letter-spacing: 0px;
font-weight: bold; font-weight: bold;
font-size: 20px; font-size: 20px;
float: left;
margin-top: 12px;
} }
.one { .item > .pm.one {
color: #d9ac64; color: #d9ac64;
} }
.two { .item > .pm.two {
color: #c4c4c0; color: #c4c4c0;
} }
.three { .item > .pm.three {
color: #ba6e40; color: #ba6e40;
} }
.lis { .item > .pm.lis {
color: #333; color: #333;
} }
.item p { .item > img {
display: inline-block; flex-shrink: 0;
height: 35px;
width: 35px;
border-radius: 50%;
margin-left: 15px;
} }
.item .name { .item > p {
position: absolute; flex-grow: 1;
left: 85px; flex-shrink: 1;
margin-left: 10px;
} }
.item .init { .item > p > .init {
position: absolute;
top: 25px;
left: 85px;
color: #8890a7; color: #8890a7;
margin-top: 3px;
} }
.item .count { .item > .count {
float: right; flex-shrink: 0;
margin-right: 25px;
margin-top: 15px;
height: 19px; height: 19px;
font-family: ArialMT; font-family: ArialMT;
font-size: 22px; font-size: 22px;
...@@ -149,5 +155,7 @@ li { ...@@ -149,5 +155,7 @@ li {
line-height: 17px; line-height: 17px;
letter-spacing: 0px; letter-spacing: 0px;
color: #515fe7; color: #515fe7;
white-space: nowrap;
margin-left: 10px;
} }
</style> </style>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment