1.不支持动态具名插槽
注意 微信小程序 动态插槽不支持默认内容
//子组件
<template v-for="(item, index) in tabItem">
<view class="flex-grow h-0 overflow-auto" v-if="computedValue === item.name" :key="index">
<!-- #ifdef MP -->
<!-- <slot name="{{item.name}}"> </slot> -->
<slot name="tab:{{index}}"> </slot>
<!-- #endif -->
<!-- #ifdef H5 || APP-PLUS -->
<!-- <slot :name="item.name"> -->
<slot :name="`tab:${index}`">
<view class="w-full h-80 flex-center">
<text class="text-c_gray-2">暂无数据{{ item.name }}</text>
</view>
</slot>
<!-- #endif -->
</view>
</template>
//父组件
<!-- #ifdef MP -->
<template v-for="(item, index) in tabItem" slot="tab:{{index}}">
<!-- #endif -->
<!-- #ifdef H5 || APP-PLUS -->
<template v-for="(item, index) in tabItem" :slot="`tab:${index}`">
<!-- #endif -->
2.打包后的App容易出现undefined
小程序和H5 中data中定义的字段,不会显示undefined
在app中会在页面中显示undefined,并且影响报错,程序被堵塞,后面的内容无法被渲染
解决办法:
//1.data中初始化变量
js: data(){
return {
obj:{
user:{userInfo:{}}
}
}
}
//2.标签上加上判断
<view v-if="obj && obj.user && obj.user.userInfo">{{obj.user.userInfo}}</view>
3.属性名不能使用dataXxxx或者data-xxx
因为微信向程序自定义属性,不能使用驼峰命名法
因为dataXxx 格式化后会变成data-xxx 是H5的属性命名
在解析 data-xxx命名时, 在js中获取的时候会将驼峰的写法转化成纯小写e.currentTarget.dataset.xxxx
4.H5 跳转到小程序
dd.biz.util.openLink()
5.app不支持css3动画
H5 可以使用css3都动画
解决ios系统的BUG
ios系统上,动画一旦开始,就不能修改了。那可以把动画停止,再修改开启动画。
但不是直接把动画时间改为0,而是使用css动画的一个属性:
anmation-play-state:paused|running;
transform不兼容
可以使用兼容语法
<!-- #ifdef H5 || MP-->
<span
class="iconfont u-server-icon iconjinrujiantou"
:class="[isCollapseShow ? 'deg1' : 'deg2']"
/>
<!--#endif-->
<!-- #ifdef APP-PLUS-->
<span v-if="isCollapseShow" class="iconfont u-server-icon iconxialajiantou"/>
<span v-else class="iconfont u-server-icon iconjinrujiantou"/>
<!--#endif-->
.....持续更新