slide-item.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="slide-box">
  3. <tantan ref="jmList" @onChange="change" @onClickImage="clickImage"></tantan>
  4. </view>
  5. </template>
  6. <script>
  7. import tantan from '@/components/dgex-tantan/dgex-tantan.vue'
  8. export default {
  9. name: "slide-item",
  10. components: {
  11. tantan
  12. },
  13. props: {},
  14. data() {
  15. return {
  16. list: []
  17. }
  18. },
  19. watch: {},
  20. mounted() {
  21. this.change({'currentIndex':1})
  22. },
  23. methods: {
  24. change(data) {
  25. // 判断倒数
  26. let arr=[]
  27. // 模拟一下最加数据
  28. const tu = [
  29. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2Fc7a27a1ej00qvpu700019c000hs00vlc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  30. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F9f81e6aaj00qvpu70001xc000hs00vmc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  31. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F55bf2cb3j00qvpu70002cc000hs012jc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  32. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F2017725bj00qvpu70001jc000hs00zxc.jpg&thumbnail=660x2147483647&quality=80&type=jpg'
  33. ]
  34. for (let index = 0; index < 10; index++) {
  35. const n = Math.floor(Math.random() * (tu.length - 1))
  36. let newdata = {
  37. image: tu[n],
  38. images: [
  39. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2Fc7a27a1ej00qvpu700019c000hs00vlc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  40. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F9f81e6aaj00qvpu70001xc000hs00vmc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  41. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F55bf2cb3j00qvpu70002cc000hs012jc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  42. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F2017725bj00qvpu70001jc000hs00zxc.jpg&thumbnail=660x2147483647&quality=80&type=jpg'
  43. ],
  44. imgIndex:0,
  45. title: '你好',
  46. age: '19',
  47. distance: '19.6',
  48. city: '香港九龙城',
  49. weChat: 'siococos',
  50. animation:{}
  51. }
  52. arr.push(newdata)
  53. }
  54. this.$refs.jmList.setData(arr)
  55. // console.log(data);
  56. },
  57. clickImage(data) {
  58. console.log(data);
  59. }
  60. }
  61. }
  62. </script>
  63. <style scoped lang="scss">
  64. .slide-box{
  65. margin-top: 10rpx;
  66. box-sizing: border-box;
  67. }
  68. </style>