vue使用Vant UI中的swiper组件及传值
子组件SwiperBanner
<!-- -->
<template>
<div class="swiper">
<van-swipe :autoplay=""
indicator-color="white">
<van-swipe-item v-for="(item,index) in imgList"
:key="index">
<img :src="item.img"
alt=""
title="" />
</van-swipe-item>
</van-swipe>
</div>
</template> <script>
import Vue from 'vue';
import { Swipe, SwipeItem } from 'vant';
Vue.use(Swipe).use(SwipeItem);
export default {
name: 'swiper',
props: {
imgList: {
type: Array,
required: true
},
aaa: '',
},
data () {
return {
};
},
}
</script>
<style lang='scss' >
.swiper {
width: %;
height: 4rem;
.van-swipe {
height: 4rem;
img {
height: %;
width: %;
}
}
}
</style>
父组件
<!-- -->
<template>
<div class="goodsDetails">
商品详情{{goodsId}}
<SwiperBanner :imgList="imgList"
:aaa="aaa"></SwiperBanner>
</div>
</template> <script>
import SwiperBanner from "@/components/SwiperBanner.vue"
export default {
components: {
SwiperBanner,
},
data () {
return {
goodsId: '',
imgList: [
{ img: "https://img.yzcdn.cn/vant/apple-1.jpg" },
{ img: "http://file02.16sucai.com/d/file/2014/0704/e53c868ee9e8e7b28c424b56afe2066d.jpg" },
{ img: "https://img.yzcdn.cn/vant/apple-1.jpg" },
{ img: "http://file02.16sucai.com/d/file/2014/0704/e53c868ee9e8e7b28c424b56afe2066d.jpg" },
],
aaa: 'wwwww'
};
},
mounted () {
var that = this
that.getGoodsId()
},
methods: {
// 获取参数
getGoodsId () {
var that = this
that.goodsId = this.$route.query.goodsId
}
},
} </script>
<style lang='scss' >
</style>
vue使用Vant UI中的swiper组件及传值的更多相关文章
- 在vue中使用swiper组件
第一步:在终端的项目根目录下载安装swiper: cnpm/npm install vue-awesome-swiper --save; 第二步:在程序入口文件main.js中引用: import V ...
- 关于element中的父子组件的传值问题
首先讲一下父子组件的传值问题. 这是大家很熟悉的一张图,讲述了父子组件传值的过程.父组件通过prop传值给子组件,子组件通过$emit给父组件发送消息来使父组件的prop发生变化.这都是老生常谈了.下 ...
- Element ui 中使用table组件实现分页记忆选中
我们再用vue和element-ui,或者其他的表格的时候,可能需要能记忆翻页勾选,那么实现以下几个方法就ok了 示例如下 <el-table :data="tableData&quo ...
- 关于Unity中UI中的Mask组件、Text组件和布局
一.Mask组件 遮罩,Rect Mask矩形Mask(Rect Mask2D组件),图片Mask(Mask组件)(图片Mask的透明度不为0的部分显示子图片,为0的部分不显示子图片) Rect Ma ...
- vue中 props 多层组件嵌套传值
如:三层嵌套. 父组件=>子组件=>孙子 1. 父组件引用子组件component11 , isShow传值给子组件component11 2. 子组件用 props 接受父组件的值, ...
- 有关vue中用element ui 中的from表单提交json格式总是有冒号的问题解决办法
因为后台要求要传递JSON格式的数据给他,然后我转了之后总是多了冒号,后来又看了自己的报错,原来是报了404错误,说明路径找不到, 数据格式 后来发现怎么都不行了,然后突然查看了报错报的是404,说明 ...
- Angular中不同的组件间传值与通信的方法
主要分为父子组件和非父子组件部分. 父子组件间参数与通讯方法 使用事件通信(EventEmitter,@Output): 场景:可以在父子组件之间进行通信,一般使用在子组件传递消息给父组件: 步骤: ...
- 关于Element UI中页面样式小问题
一,修改组件dialog窗口的大小 二,在我使用upload组件上传一张美女图片时,发现当预览图片时,图片是灰色的,点击一下才会变亮,这种效果使我很不舒服,于是我通过添加下面的一条样式,问题解决了(可 ...
- vue父子组件的传值总结
久违的博客园我又回来了.此篇文章写得是vue父子组件的传值,虽然网上已经有很多了.写此文章的目的就是记录下个人学习的一部分.接下来我们就进入主题吧! 在开发vue项目中,父子组件的传值是避免不掉的. ...
随机推荐
- CentOS配置源、wget、ifconfig基础环境
执行命令: curl http://10.200.0.14:8000/portal.cgi -X POST -d 'username=lishuai&password=test@cetc38& ...
- Lamda ForEach使用
List<User> list = new List<User>() { }, }, }, }; list.ForEach(p => Console.WriteLine( ...
- ssm框架前后端数据交互完整示例
1.sprinMvc控制层 package com.dengfeng.house.controller; import java.text.ParseException; import java.ut ...
- BUU pwn cn
自己不细心,人家别的博客上写的明明没有那个冒号的,把linux命令好好学一学吧! nc后 ls 发现flag文件 cat就得到flag了
- js左右选项移动
<!--网页代码--><div class="modal" id="modal-primary7"> <div class=&qu ...
- spring源码第一章_获取源码并将源码转为eclipse工程
1.通过http://gitforwindows.org/下载github 2.通过http://services.gradle.org/distributions/下载gradle:gardle类似 ...
- python2学习------基础语法1 (变量、分支语句、循环语句、字符串操作)
1.变量类型 Numbers(数字):int,float,long String(字符串) List(列表) tuple(元组) dict(字典) bool(布尔):True,False # 删除变量 ...
- spoj694--Distinct Substrings
个人第一道后缀数组题目.对于每一个后缀suffix(i),都有len-sa[i]个前缀(也即有len-sa[i]个不同的字符串),其中与排名前一位的后缀有height[i]个共同的前缀,最后所得到的新 ...
- php中常用的加密函数
1.MD5加密: string md5 ( string $str [, bool $raw_output = false ] ) (1)md5()默认情况下以 32 字符十六进制数字形式返回散列值, ...
- 九、响应式发:rem和less(适配移动端)
一.响应式开发 响应式开发优先适配移动端又兼容到pc端 官网:https://less.bootcss.com/usage/ 教程:https://www.w3cschool.cn/less/ rem ...