# wx-miniapp **Repository Path**: tuhe32/wx-miniapp ## Basic Information - **Project Name**: wx-miniapp - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-10 - **Last Updated**: 2021-12-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 当时跟郝哥调页面用的 ## 注意事项 ### 1、class 绑定:wx:class="{\{['login_logo',{animate :isActive},{shake: isActive}]}\}" - 多个判断 class,和一个固定 class 的写法,其他情况都可从中衍生 ### 2、animate.css https://github.com/daneden/animate.css - 自定义动画时长,延时,循环播放动画 .yourElement { animation-duration: 3s; animation-delay: 2s; animation-iteration-count: infinite; } - "

Example

" ### 3、导入项目的时候可以选择项目文件夹,然后在项目配置中 配置:"miniprogramRoot": "dist/", 但是真机调试以及上传时需要将 dist 文件里的 projec.config.json 中的"miniprogramRoot": "dist/"删除,不然上传不了!!! 官方答复: -(1)将 wepach.wx.conf.js 中的 copy-plugin 注释掉; -(2)推荐,直接打开 dist 文件夹 ### 4、自定义 tabbar ,每个 tabbar 页面都需要在 show 中处理 selected 选中状态 - (1)、第一步,需要在 app.mpx 中 tabbar 的设置里增加"custom": true, 开启自定义 tabbar ,关闭则反之 - (2)、custom-tab-bar 文件夹下建立 index.mpx - (3)、每个 tabbar 页面的 show 中处理 selected 选中状态 ### 5、组件的使用 - (1)、组件的注册以及使用和原生一样 - (2)、组件的传参:父组件传参:todo="{\{tab1}\}" index="{\{index}\}" - (3)、子组件事件通信:bind:showDetail="showDetail" ==> bind:事件名="调用的父组件方法" - (4)、子组件:this.triggerEvent('showDetail', {value: 'child component'}) 触发事件 - (5)、父组件调用子组件的方法,this.selectComponent('.sharePopup').makeShareCanvas(); 加个类选择器后,直接调用即可 ### 6、json 中不允许出现单引号'',注释,最后一个键值对不能有逗号(,) !!! ### 7、分包可以有多个,只要满足单个分包不超过 2M,整个项目不超过 8M 的要求即可,可以每个模块一个分包。主包中包含 tabbar 页面以及登录页,其他的可以放到分包中 - (1)、分包后,由于跳转路径变成需要加分包的 root 的前缀,为了正确获得 redirect 或者 navigate 的路径,官方提供 import setPath from '../packages/user/set.mpx?resolve'; 获取正确的路径(不是引入页面,不占空间,只是用于编译时生成一个正确的路径字符串) ### 8、sticky 外层要有一个将所有元素包括可滚动部分的包起来父标签