• 【uni-app】


    准备工作(Hbuilder)

    1.下载hbuilder,插件使用Vue3的uni-app项目

    2.需要安装编译器

    3.下载微信开发者工具 

    4.点击运行->微信开发者工具

    5.打开微信开发者工具的服务端口

    效果图

    准备工作(VScode)

    插件

    uni-create-view

    uni-helper

    uniapp小程序扩展 

    page.json(添加路由,修改底层导航栏,背景色)

    添加路由

    1. "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
    2. {
    3. "path": "pages/index/index",
    4. "style": {
    5. "navigationBarTitleText": "首页"
    6. }
    7. }
    8. ,{
    9. "path" : "pages/my/my",
    10. "style" :
    11. {
    12. "navigationBarTitleText": "我的"
    13. }
    14. }
    15. ]

    修改背景颜色 

    1. "globalStyle": {
    2. "navigationBarTextStyle": "black",
    3. "navigationBarTitleText": "uni-app",
    4. "navigationBarBackgroundColor": "#F8F8F8",
    5. "backgroundColor": "#F8F8F8"
    6. }

    添加导航栏(至少两个)

    1. "tabBar": {
    2. "list": [
    3. {
    4. "pagePath": "pages/index/index","text": "首页"
    5. },{
    6. "pagePath": "pages/my/my","text": "我的"
    7. }
    8. ]
    9. },

    manifest.json(添加AppID)

    添加AppID

    轮播图实现

    1. <template>
    2. <swiper class="banner" indicator-dots circular :autoplay="false">
    3. <swiper-item v-for="item in pictures" :key="item.id">
    4. <image @tap="onPreviewImage(item.url)" :src="item.url">image>
    5. swiper-item>
    6. swiper>
    7. template>
    8. <script>
    9. export default {
    10. data() {
    11. return {
    12. title: 'Hello',
    13. pictures: [{
    14. id: '1',
    15. url: "../../static/uploads/goods_preview_1.jpg"
    16. },
    17. {
    18. id: '2',
    19. url: "../../static/uploads/goods_preview_2.jpg"
    20. },
    21. {
    22. id: '3',
    23. url: "../../static/uploads/goods_preview_3.jpg"
    24. },
    25. {
    26. id: '4',
    27. url: "../../static/uploads/goods_preview_4.jpg"
    28. },
    29. {
    30. id: '5',
    31. url: "../../static/uploads/goods_preview_5.jpg"
    32. },
    33. ]
    34. }
    35. },
    36. onLoad() {
    37. },
    38. methods: {
    39. onPreviewImage(url) {
    40. // console(url);
    41. wx.previewImage({
    42. urls: this.pictures.map(v => v.url),
    43. current: url
    44. })
    45. }
    46. }
    47. }
    48. script>
    49. <style>
    50. .banner,
    51. .banner image {
    52. width: 750rpx;
    53. height: 750rpx;
    54. }
    55. .content {
    56. display: flex;
    57. flex-direction: column;
    58. align-items: center;
    59. justify-content: center;
    60. }
    61. .logo {
    62. height: 200rpx;
    63. width: 200rpx;
    64. margin-top: 200rpx;
    65. margin-left: auto;
    66. margin-right: auto;
    67. margin-bottom: 50rpx;
    68. }
    69. .text-area {
    70. display: flex;
    71. justify-content: center;
    72. }
    73. .title {
    74. font-size: 36rpx;
    75. color: #8f8f94;
    76. }
    77. style>

  • 相关阅读:
    Linux yum,vim详解
    微服务:服务拆分和远程调用
    计算机毕设(附源码)JAVA-SSM基于课程群的实验管理平台
    SQL Server安装
    技术成神之路:设计模式(一)单例模式
    Socket 服务端实例学习笔记
    Java项目在linux上部署步骤
    Java中transient关键字的详细总结
    LeetCode-538. Convert BST to Greater Tree [C++][Java]
    10-网络篇-DHCP获取的参数详解
  • 原文地址:https://blog.csdn.net/David_Hzy/article/details/132744648