<template>
<view class="content">
<!-- #ifdef H5 -->
<view>只在H5中显示</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view>只在微信小程序中显示</view>
<!-- #endif -->
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
},
onLoad() {
// #ifdef H5
console.log('我希望在H5中打印')
// #endif
// #ifdef MP-WEIXIN
console.log("我希望在微信小程序中打印")
// #endif
}
}
</script>
<style>
/* #ifdef H5 */
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background:#007AFF
}
/* #endif */
/* #ifdef MP-WEIXIN */
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background:#4CD964
}
/* #endif */
</style>
uniapp跨端兼容
猜你喜欢
转载自blog.csdn.net/qq2942713658/article/details/114110059
今日推荐
周排行