slide-item.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. import inobounce from "inobounce";
  9. export default {
  10. name: "slide-item",
  11. components: {
  12. tantan
  13. },
  14. props: {},
  15. data() {
  16. return {
  17. list: []
  18. }
  19. },
  20. watch: {},
  21. created() {
  22. let u = navigator.userAgent
  23. if (u.indexOf('iPhone') > -1) {
  24. inobounce.enable()
  25. }
  26. },
  27. beforeDestroy() {
  28. inobounce.disable()
  29. },
  30. mounted() {
  31. this.change({'currentIndex':1})
  32. },
  33. methods: {
  34. change(data) {
  35. // 判断倒数
  36. let arr=[]
  37. // 模拟一下最加数据
  38. const tu = [
  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. for (let index = 0; index < 10; index++) {
  45. const n = Math.floor(Math.random() * (tu.length - 1))
  46. let newdata = {
  47. image: tu[n],
  48. images: [
  49. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2Fc7a27a1ej00qvpu700019c000hs00vlc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  50. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F9f81e6aaj00qvpu70001xc000hs00vmc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  51. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F55bf2cb3j00qvpu70002cc000hs012jc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
  52. 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0704%2F2017725bj00qvpu70001jc000hs00zxc.jpg&thumbnail=660x2147483647&quality=80&type=jpg'
  53. ],
  54. imgIndex:0,
  55. title: '你好',
  56. age: '19',
  57. distance: '19.6',
  58. city: '香港九龙城',
  59. weChat: 'siococos',
  60. animation:{}
  61. }
  62. arr.push(newdata)
  63. }
  64. this.$refs.jmList.setData(arr)
  65. // console.log(data);
  66. },
  67. clickImage(data) {
  68. console.log(data);
  69. }
  70. }
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. .slide-box{
  75. margin-top: 10rpx;
  76. box-sizing: border-box;
  77. }
  78. </style>