|
@@ -1,24 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <div class="view">
|
|
|
|
- <div class="img-box">
|
|
|
|
- <div class="show-box" :style="{
|
|
|
|
- transform: 'translateX(' + translate + 'px)',
|
|
|
|
- transition: tsion ? 'all 0.5s' : 'none',
|
|
|
|
- }" ref="swip">
|
|
|
|
- <img src="https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500" alt="" />
|
|
|
|
- <img v-for="(item, i) in src" :key="i" :src="item.img" alt="" class="imgg" />
|
|
|
|
- <img src="https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500" alt="" />
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div class="arrowhead-box">
|
|
|
|
- <span @click="last"><img src="../../assets/OIP-C.jpg" alt="" style="height: 40px; width: 40px" /></span>
|
|
|
|
- <span @click="next"><img src="../../assets/OIP-C.jpg" alt="" style="height: 40px; width: 40px" /></span>
|
|
|
|
- </div>
|
|
|
|
- <div class="swiper-boxs" ref="swiper">
|
|
|
|
- <span v-for="(item, i) in src" :key="i" @click="swiper(i)"></span>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <swipe :msg="src" ref="aa"></swipe>
|
|
<button @click="change3">多图轮播</button>
|
|
<button @click="change3">多图轮播</button>
|
|
<button @click="change2">圆角</button>
|
|
<button @click="change2">圆角</button>
|
|
<button @click="change1">颜色直角</button>
|
|
<button @click="change1">颜色直角</button>
|
|
@@ -27,25 +9,20 @@
|
|
<button @click="tabChange4">改变tab图片</button>
|
|
<button @click="tabChange4">改变tab图片</button>
|
|
<button @click="tabChange5">改变tab标题</button>
|
|
<button @click="tabChange5">改变tab标题</button>
|
|
<button @click="tabChange3">改变tab</button>
|
|
<button @click="tabChange3">改变tab</button>
|
|
|
|
+ <tab :msg="tabBarImg" ref="bb"></tab>
|
|
|
|
|
|
- <div class="tab" ref="tabs">
|
|
|
|
- <div class="tab_item" v-for="(item, index) in tabBarImg" :key="index" @click="switchToTab(item.path)">
|
|
|
|
- <img :src="item.normal" alt="" />
|
|
|
|
- <span :class="$route.path === item.path ? 'active' : ''">{{
|
|
|
|
- item.title
|
|
|
|
- }}</span>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
|
|
+ <!-- <list></list> -->
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import swipe from "../../moudel/swipe/index.vue";
|
|
|
|
+import tab from "../../moudel/tab/tab.vue";
|
|
|
|
+import list from "../../moudel/list/list.vue";
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
- translateX: 0,
|
|
|
|
- tsion: true,
|
|
|
|
src: [
|
|
src: [
|
|
{
|
|
{
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
@@ -56,101 +33,101 @@ export default {
|
|
{
|
|
{
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
},
|
|
},
|
|
-
|
|
|
|
],
|
|
],
|
|
tabBarImg: [
|
|
tabBarImg: [
|
|
{
|
|
{
|
|
- path: '/home',
|
|
|
|
- normal: require('../../assets/首页.png'),
|
|
|
|
|
|
+ path: "/home",
|
|
|
|
+ normal: require("../../assets/首页.png"),
|
|
// icon: require('./../assets/images/ahome.png'),
|
|
// icon: require('./../assets/images/ahome.png'),
|
|
- title: '首页'
|
|
|
|
|
|
+ title: "首页",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- path: '/chat',
|
|
|
|
- normal: require('../../assets/列表.png'),
|
|
|
|
|
|
+ path: "/chat",
|
|
|
|
+ normal: require("../../assets/列表.png"),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
- title: '列表'
|
|
|
|
|
|
+ title: "列表",
|
|
},
|
|
},
|
|
|
|
|
|
{
|
|
{
|
|
- path: '/login',
|
|
|
|
- normal: require('../../assets/我的.png'),
|
|
|
|
|
|
+ path: "/login",
|
|
|
|
+ normal: require("../../assets/我的.png"),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
- title: '我的'
|
|
|
|
|
|
+ title: "我的",
|
|
},
|
|
},
|
|
- ]
|
|
|
|
-
|
|
|
|
|
|
+ ],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ components: {
|
|
|
|
+ swipe,
|
|
|
|
+ tab,
|
|
|
|
+ list,
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
- //改变tab底色,文字颜色
|
|
|
|
- tabChange3 () {
|
|
|
|
- let a = this.$refs.tabs.querySelectorAll("div");
|
|
|
|
- a.forEach((element) => {
|
|
|
|
- element.style.background = "hotpink";
|
|
|
|
- element.style.color = "white";
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
//改变tab图片
|
|
//改变tab图片
|
|
tabChange4 () {
|
|
tabChange4 () {
|
|
this.tabBarImg = [
|
|
this.tabBarImg = [
|
|
{
|
|
{
|
|
- path: '/home',
|
|
|
|
- normal: require('../../assets/蝴蝶结.png'),
|
|
|
|
|
|
+ path: "/home",
|
|
|
|
+ normal: require("../../assets/蝴蝶结.png"),
|
|
// icon: require('./../assets/images/ahome.png'),
|
|
// icon: require('./../assets/images/ahome.png'),
|
|
- title: '首页'
|
|
|
|
|
|
+ title: "首页",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- path: '/chat',
|
|
|
|
- normal: require('../../assets/列表.png'),
|
|
|
|
|
|
+ path: "/chat",
|
|
|
|
+ normal: require("../../assets/列表.png"),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
- title: '列表'
|
|
|
|
|
|
+ title: "列表",
|
|
},
|
|
},
|
|
|
|
|
|
{
|
|
{
|
|
- path: '/login',
|
|
|
|
- normal: require('../../assets/蝴蝶结.png'),
|
|
|
|
|
|
+ path: "/login",
|
|
|
|
+ normal: require("../../assets/蝴蝶结.png"),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
- title: '我的'
|
|
|
|
|
|
+ title: "我的",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- path: '/login',
|
|
|
|
- normal: require('../../assets/我的.png'),
|
|
|
|
|
|
+ path: "/login",
|
|
|
|
+ normal: require("../../assets/我的.png"),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
- title: '我的'
|
|
|
|
|
|
+ title: "我的",
|
|
},
|
|
},
|
|
-
|
|
|
|
- ]
|
|
|
|
-
|
|
|
|
|
|
+ ];
|
|
},
|
|
},
|
|
- //改变tab标题
|
|
|
|
|
|
+
|
|
tabChange5 () {
|
|
tabChange5 () {
|
|
this.tabBarImg = [
|
|
this.tabBarImg = [
|
|
{
|
|
{
|
|
- path: '/home',
|
|
|
|
- normal: require('../../assets/首页.png'),
|
|
|
|
|
|
+ path: "/home",
|
|
|
|
+ normal: require("../../assets/首页.png"),
|
|
// icon: require('./../assets/images/ahome.png'),
|
|
// icon: require('./../assets/images/ahome.png'),
|
|
- title: '啦啦啦啦啦'
|
|
|
|
|
|
+ title: "啦啦啦啦啦",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- path: '/chat',
|
|
|
|
- normal: require('../../assets/列表.png'),
|
|
|
|
|
|
+ path: "/chat",
|
|
|
|
+ normal: require("../../assets/列表.png"),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
- title: '啦啦啦啦啦'
|
|
|
|
|
|
+ title: "啦啦啦啦啦",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- path: '/login',
|
|
|
|
- normal: require('../../assets/我的.png'),
|
|
|
|
|
|
+ path: "/login",
|
|
|
|
+ normal: require("../../assets/我的.png"),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
// icon: require('./../assets/images/ahead.png'),
|
|
- title: '啦啦啦啦啦'
|
|
|
|
|
|
+ title: "啦啦啦啦啦",
|
|
},
|
|
},
|
|
|
|
+ ];
|
|
|
|
+ },
|
|
|
|
|
|
- ]
|
|
|
|
|
|
+ tabChange3 () {
|
|
|
|
+ let a = this.$refs.bb.$refs.tabs.querySelectorAll("div");
|
|
|
|
+ a.forEach((element) => {
|
|
|
|
+ element.style.background = "hotpink";
|
|
|
|
+ element.style.color = "white";
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- //轮播五图
|
|
|
|
|
|
+
|
|
change3 () {
|
|
change3 () {
|
|
- console.log(11);
|
|
|
|
- this.src = [
|
|
|
|
|
|
+ console.log(111);
|
|
|
|
+ let src = [
|
|
{
|
|
{
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
},
|
|
},
|
|
@@ -166,227 +143,36 @@ export default {
|
|
{
|
|
{
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
img: "https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=751&h=500",
|
|
},
|
|
},
|
|
-
|
|
|
|
- ]
|
|
|
|
|
|
+ ];
|
|
|
|
+ this.src = src;
|
|
|
|
+ },
|
|
|
|
+ change2 () {
|
|
|
|
+ let a = this.$refs.aa.$refs.swiper.querySelectorAll("span");
|
|
|
|
+ a.forEach((element) => {
|
|
|
|
+ element.style.borderRadius = "50px";
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- //改变轮播图分页器颜色圆角
|
|
|
|
change1 () {
|
|
change1 () {
|
|
- let a = this.$refs.swiper.querySelectorAll("span");
|
|
|
|
|
|
+ let a = this.$refs.aa.$refs.swiper.querySelectorAll("span");
|
|
a.forEach((element) => {
|
|
a.forEach((element) => {
|
|
-
|
|
|
|
element.style.width = "12px";
|
|
element.style.width = "12px";
|
|
element.style.background = "hotpink";
|
|
element.style.background = "hotpink";
|
|
element.style.borderRadius = "1px";
|
|
element.style.borderRadius = "1px";
|
|
});
|
|
});
|
|
},
|
|
},
|
|
-
|
|
|
|
change5 () {
|
|
change5 () {
|
|
- // let a = this.$refs.swiper
|
|
|
|
- // console.log(a)
|
|
|
|
- // let b = this.$refs.swiper.querySelectorAll("span");
|
|
|
|
- // b.forEach((element) => {
|
|
|
|
- // a.removeChild(element)
|
|
|
|
- // });
|
|
|
|
- let a = this.$refs.swiper.querySelectorAll("span");
|
|
|
|
|
|
+ let a = this.$refs.aa.$refs.swiper.querySelectorAll("span");
|
|
a.forEach((element) => {
|
|
a.forEach((element) => {
|
|
- element.style.display = "none"
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- change2 () {
|
|
|
|
- let a = this.$refs.swiper.querySelectorAll("span");
|
|
|
|
- a.forEach((element) => {
|
|
|
|
- console.log(element);
|
|
|
|
-
|
|
|
|
- element.style.borderRadius = "50px";
|
|
|
|
|
|
+ element.style.display = "none";
|
|
});
|
|
});
|
|
},
|
|
},
|
|
change4 () {
|
|
change4 () {
|
|
- let a = this.$refs.swip.querySelectorAll("img");
|
|
|
|
|
|
+ console.log(this.$refs.aa.$refs.swip);
|
|
|
|
+ let a = this.$refs.aa.$refs.swip.querySelectorAll("img");
|
|
a.forEach((element) => {
|
|
a.forEach((element) => {
|
|
- console.log(element);
|
|
|
|
-
|
|
|
|
element.style.borderRadius = "12px";
|
|
element.style.borderRadius = "12px";
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- last () {
|
|
|
|
- this.translateX--;
|
|
|
|
- this.tsion = true;
|
|
|
|
- if (this.translateX < 0) {
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.tsion = false;
|
|
|
|
- this.translateX = this.src.length - 1;
|
|
|
|
- }, 500);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- next () {
|
|
|
|
- this.translateX++;
|
|
|
|
- this.tsion = true;
|
|
|
|
- if (this.translateX > this.src.length - 1) {
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.tsion = false;
|
|
|
|
- this.translateX = 0;
|
|
|
|
- }, 500);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- switchToTab (path) {
|
|
|
|
- // console.log(path);
|
|
|
|
- // this.$router.replace(path);
|
|
|
|
- },
|
|
|
|
- swiper (i) {
|
|
|
|
- this.translateX = i;
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- mounted () {
|
|
|
|
- setInterval(() => {
|
|
|
|
- this.next();
|
|
|
|
- }, 3000);
|
|
|
|
- },
|
|
|
|
- computed: {
|
|
|
|
- translate () {
|
|
|
|
- return -(this.translateX + 1) * 383;
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- watch: {
|
|
|
|
- translateX: {
|
|
|
|
- handler (val) {
|
|
|
|
- let a = this.$refs.swiper.querySelectorAll("span");
|
|
|
|
- a.forEach((element) => {
|
|
|
|
- element.style.width = "12px";
|
|
|
|
- });
|
|
|
|
- if (this.translateX < 0) {
|
|
|
|
- val = this.src.length - 1;
|
|
|
|
- }
|
|
|
|
- if (this.translateX > this.src.length - 1) {
|
|
|
|
- val = 0;
|
|
|
|
- }
|
|
|
|
- a[val].style.width = "30px";
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
-<style scoped>
|
|
|
|
-* {
|
|
|
|
- margin: 0;
|
|
|
|
- padding: 0;
|
|
|
|
-}
|
|
|
|
-.tab {
|
|
|
|
- width: 100%;
|
|
|
|
- height: 10vh;
|
|
|
|
- display: flex;
|
|
|
|
- border-top: 1px solid #ccc;
|
|
|
|
- position: fixed;
|
|
|
|
- bottom: 0;
|
|
|
|
- background: #fff;
|
|
|
|
- z-index: 999;
|
|
|
|
- /* color: midnightblue; */
|
|
|
|
-}
|
|
|
|
-.tab_item {
|
|
|
|
- /* background: white; */
|
|
|
|
- width: 100%;
|
|
|
|
- display: flex;
|
|
|
|
- align-items: center;
|
|
|
|
- justify-content: space-around;
|
|
|
|
- flex-direction: column;
|
|
|
|
-}
|
|
|
|
-.tab_item img {
|
|
|
|
- margin-top: 5px;
|
|
|
|
- width: 30px;
|
|
|
|
- height: 30px;
|
|
|
|
-}
|
|
|
|
-.tab_item span {
|
|
|
|
- margin-top: -10px;
|
|
|
|
-}
|
|
|
|
-.active {
|
|
|
|
- color: blue;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-body {
|
|
|
|
- margin: 0;
|
|
|
|
- padding: 0;
|
|
|
|
- background-image: linear-gradient(to top, #37ecba 0%, #72afd3 100%);
|
|
|
|
-}
|
|
|
|
-button {
|
|
|
|
- width: 90px;
|
|
|
|
- height: 85px;
|
|
|
|
- margin-top: 10px;
|
|
|
|
-}
|
|
|
|
-.view {
|
|
|
|
- width: 380px;
|
|
|
|
- /* height: 160px; */
|
|
|
|
- margin-top: 10px;
|
|
|
|
-}
|
|
|
|
-span {
|
|
|
|
- margin: 0;
|
|
|
|
- padding: 0;
|
|
|
|
-}
|
|
|
|
-.big-box {
|
|
|
|
- width: 100%;
|
|
|
|
- background-color: #999;
|
|
|
|
- margin: 10px auto;
|
|
|
|
- /* position: fixed; */
|
|
|
|
- position: absolute;
|
|
|
|
- margin-top: 2%;
|
|
|
|
- margin-left: 2%;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-.show-box {
|
|
|
|
- display: flex;
|
|
|
|
- transition: all 0.5s;
|
|
|
|
-}
|
|
|
|
-.show-box img {
|
|
|
|
- float: left;
|
|
|
|
- min-width: 384px;
|
|
|
|
- height: 200px;
|
|
|
|
-}
|
|
|
|
-.arrowhead-box {
|
|
|
|
- position: fixed;
|
|
|
|
- top: 160px;
|
|
|
|
- float: left;
|
|
|
|
- width: 100%;
|
|
|
|
- height: 50px;
|
|
|
|
-}
|
|
|
|
-.arrowhead-box span {
|
|
|
|
- float: left;
|
|
|
|
- display: block;
|
|
|
|
- /* height: 60px; */
|
|
|
|
- border-radius: 50px;
|
|
|
|
- background-position: 6px 14px;
|
|
|
|
- cursor: pointer;
|
|
|
|
- opacity: 0.5;
|
|
|
|
-}
|
|
|
|
-.arrowhead-box span img {
|
|
|
|
- border-radius: 50px;
|
|
|
|
-}
|
|
|
|
-.arrowhead-box span:nth-child(2) {
|
|
|
|
- float: right;
|
|
|
|
- transform: rotate(180deg);
|
|
|
|
-}
|
|
|
|
-.arrowhead-box span:hover {
|
|
|
|
- opacity: 1;
|
|
|
|
-}
|
|
|
|
-.swiper-boxs {
|
|
|
|
- width: 100%;
|
|
|
|
- height: 50px;
|
|
|
|
- display: flex;
|
|
|
|
- align-items: center;
|
|
|
|
- justify-content: center;
|
|
|
|
- position: fixed;
|
|
|
|
- top: 230px;
|
|
|
|
-}
|
|
|
|
-.swiper-boxs span {
|
|
|
|
- float: left;
|
|
|
|
- width: 12px;
|
|
|
|
- height: 12px;
|
|
|
|
- background-color: rgb(250, 177, 177);
|
|
|
|
- border-radius: 50px;
|
|
|
|
- margin-left: 10px;
|
|
|
|
- cursor: pointer;
|
|
|
|
- transition: all 0.5s;
|
|
|
|
-}
|
|
|
|
-.swiper-boxs span:nth-child(1) {
|
|
|
|
- width: 30px;
|
|
|
|
-}
|
|
|
|
-</style>
|
|
|