Skip to content

Commit

Permalink
处理多个组件在微信小程序上的兼容问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wlxuqu committed Nov 1, 2021
1 parent 56c97ba commit fe64a40
Show file tree
Hide file tree
Showing 11 changed files with 717 additions and 711 deletions.
197 changes: 103 additions & 94 deletions components/page-nav/page-nav.vue
Original file line number Diff line number Diff line change
@@ -1,99 +1,108 @@
<template>
<view class="nav-wrap">
<view class="nav-title">
<u--image :showLoading="true" src="https://cdn.uviewui.com/uview/common/logo.png" width="70px" height="70px"/>
<view class="nav-info">
<text class="nav-title__text" @tap="jumpToWx">
uView 2.0
<template>
<view class="nav-wrap">
<view class="nav-title">
<u--image :showLoading="true" src="https://cdn.uviewui.com/uview/common/logo.png" width="70px"
height="70px" />
<view class="nav-info">
<view class="nav-info__title">
<text class="nav-info__title__text" @tap="jumpToWx">uView 2.0</text>
<!-- #ifdef MP-WEIXIN -->
<!-- uni-app不支持text内部的text组件的tap事件,所以放到外部响应tap -->
<text class="nav-jump">查看1.x演示</text>
<text class="nav-info__title__jump">查看1.x演示</text>
<!-- #endif -->
</text>
<text class="nav-slogan">多平台快速开发的UI框架</text>
</view>
</view>
<text class="nav-desc">{{desc}}</text>
</view>
</template>

<script>
export default {
props: {
desc: String,
title: String,
},
methods: {
jumpToWx() {
// #ifdef MP-WEIXIN
uni.navigateToMiniProgram({
appId: 'wx3be833c4a263e0c2'
})
// #endif
}
},
}
</script>

<style lang="scss" scoped>
.nav-wrap {
padding: 15px;
position: relative;
}
.lang {
position: absolute;
top: 15px;
right: 15px;
}
.nav-title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.nav-info {
</view>
<text class="nav-slogan">多平台快速开发的UI框架</text>
</view>
</view>
<text class="nav-desc">{{desc}}</text>
</view>
</template>

<script>
export default {
props: {
desc: String,
title: String,
},
methods: {
jumpToWx() {
// #ifdef MP-WEIXIN
uni.navigateToMiniProgram({
appId: 'wx3be833c4a263e0c2'
})
// #endif
}
},
}
</script>

<style lang="scss" scoped>
.nav-wrap {
padding: 15px;
position: relative;
}
.lang {
position: absolute;
top: 15px;
right: 15px;
}
.nav-title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.nav-info {
margin-left: 15px;
}
.nav-title__text {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
color: $u-main-color;
font-size: 25px;
font-weight: bold;
align-items: flex-end;
}
.nav-jump {
font-size: 12px;
color: $u-primary;
font-weight: normal;
margin-left: 20px;
}
.logo {
width: 70px;
height: 70px;
/* #ifndef APP-NVUE */
height: auto;
/* #endif */
}
.nav-slogan {
color: $u-tips-color;
font-size: 14px;
}
.nav-desc {
margin-top: 10px;
font-size: 14px;
color: $u-content-color;
line-height: 20px;
}
&__title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
&__text {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
color: $u-main-color;
font-size: 25px;
font-weight: bold;
text-align: left;
}
&__jump {
font-size: 12px;
color: $u-primary;
font-weight: normal;
margin-left: 20px;
}
}
}
.logo {
width: 70px;
height: 70px;
/* #ifndef APP-NVUE */
height: auto;
/* #endif */
}
.nav-slogan {
color: $u-tips-color;
font-size: 14px;
}
.nav-desc {
margin-top: 10px;
font-size: 14px;
color: $u-content-color;
line-height: 20px;
}
</style>
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@
"mp-weixin" : {
"appid" : "wxc256e348c4032ebd",
"setting" : {
"urlCheck" : true,
"urlCheck" : false,
"es6" : false,
"minified" : false,
"postcss" : true
"postcss" : false
},
"optimization" : {
"subPackages" : true
Expand Down
2 changes: 1 addition & 1 deletion pages/componentsA/button/button.nvue
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@

<view class="u-demo-block">
<text class="u-demo-block__title">自定义大小</text>
<view class="u-demo-block__content" style="padding-bottom: 15px; flex-direction: column;align-items: stretch;">
<view class="u-demo-block__content" style="padding-bottom: 15px; flex-direction: row;align-items: stretch;">
<u-button
text="超大尺寸"
size="large"
Expand Down
61 changes: 32 additions & 29 deletions pages/componentsB/collapse/collapse.nvue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<u-collapse-item
title="文档指南"
name="Docs guide"
>
>
<text class="u-collapse-content">涵盖uniapp各个方面,给开发者方向指导和设计理念,让您茅塞顿开,一马平川</text>
</u-collapse-item>
<u-collapse-item
Expand Down Expand Up @@ -72,37 +72,40 @@
<text class="u-collapse-content">众多的贴心小工具,是您开发过程中召之即来的利器,让您飞镖在手,百步穿杨</text>
</u-collapse-item>
</u-collapse>
</view>
<view class="u-page__item">
<text class="u-page__item__title">自定义标题和内容</text>
<u-collapse
accordion
>
<u-collapse-item
>
<text slot="title" class="u-page__item__title__slot-title">文档指南</text>
<text class="u-collapse-content">涵盖uniapp各个方面,给开发者方向指导和设计理念,让您茅塞顿开,一马平川</text>
</view>
<!-- 微信小程序不支持,因为微信中不支持 <slot name="title" slot="title" />的写法 -->
<!-- #ifndef MP-WEIXIN -->
<view class="u-page__item">
<text class="u-page__item__title">自定义标题和内容</text>
<u-collapse
accordion
>
<u-collapse-item
>
<text slot="title" class="u-page__item__title__slot-title">文档指南</text>
<text class="u-collapse-content">涵盖uniapp各个方面,给开发者方向指导和设计理念,让您茅塞顿开,一马平川</text>
</u-collapse-item>
<!-- <u-collapse-item
:isLink="false"
>
<text slot="title" class="u-page__item__title__slot-title">文档指南</text>
<text class="u-collapse-content">涵盖uniapp各个方面,给开发者方向指导和设计理念,让您茅塞顿开,一马平川</text>
</u-collapse-item> -->
<u-collapse-item
title="组件全面"
>
<u-icon name="tags-fill" size="20" slot="icon"></u-icon>
<text class="u-collapse-content">众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让您快速集成,开箱即用</text>
</u-collapse-item>
<u-collapse-item
title="众多利器"
>
<text slot="value" class="u-page__item__title__slot-title">自定义内容</text>
<text class="u-collapse-content">众多的贴心小工具,是您开发过程中召之即来的利器,让您飞镖在手,百步穿杨</text>
</u-collapse-item>
</u-collapse>
</view>
</u-collapse-item> -->
<u-collapse-item
title="组件全面"
>
<u-icon name="tags-fill" size="20" slot="icon"></u-icon>
<text class="u-collapse-content">众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让您快速集成,开箱即用</text>
</u-collapse-item>
<u-collapse-item
title="众多利器"
>
<text slot="value" class="u-page__item__title__slot-title">自定义内容</text>
<text class="u-collapse-content">众多的贴心小工具,是您开发过程中召之即来的利器,让您飞镖在手,百步穿杨</text>
</u-collapse-item>
</u-collapse>
</view>
<!-- #endif -->
<u-gap height="50"></u-gap>
</view>
</template>
Expand All @@ -115,13 +118,13 @@
},
methods: {
open(e) {
console.log('open', e)
// console.log('open', e)
},
close(e) {
console.log('close', e)
// console.log('close', e)
},
change(e) {
console.log('change', e)
// console.log('change', e)
}
}
}
Expand Down
Loading

0 comments on commit fe64a40

Please sign in to comment.