Skip to content

Commit

Permalink
fix: 修复支付宝小程序中部分兼容问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1206 committed Jul 6, 2023
1 parent daa77d5 commit 6fa5132
Show file tree
Hide file tree
Showing 21 changed files with 81 additions and 42 deletions.
14 changes: 14 additions & 0 deletions example/manifest.config.ts
Expand Up @@ -16,6 +16,20 @@ export default defineManifestConfig({
postcss: true,
},
usingComponents: true,
lazyCodeLoading: 'requiredComponents',
darkmode: true,
themeLocation: 'theme.json',
},
'mp-alipay': {
appid: 'wxd4e6c25454525507',
setting: {
urlCheck: false,
es6: true,
minified: true,
postcss: true,
},
usingComponents: true,
lazyCodeLoading: 'requiredComponents',
darkmode: true,
themeLocation: 'theme.json',
},
Expand Down
2 changes: 1 addition & 1 deletion example/src/manifest.json
@@ -1 +1 @@
{"name":"NutUi","appid":"__UNI__D989E4B","description":"","versionName":"1.0.0","versionCode":"100","transformPx":false,"mp-weixin":{"appid":"wxd4e6c25454525507","setting":{"urlCheck":false,"es6":true,"minified":true,"postcss":true},"usingComponents":true,"darkmode":true,"themeLocation":"theme.json"},"uniStatistics":{"enable":false},"h5":{"darkmode":true,"themeLocation":"theme.json"},"vueVersion":"3","app-plus":{"darkmode":true,"distribute":{"ios":{"dSYMs":false},"sdkConfigs":{"ad":{}}}}}
{"name":"NutUi","appid":"__UNI__D989E4B","description":"","versionName":"1.0.0","versionCode":"100","transformPx":false,"mp-weixin":{"appid":"wxd4e6c25454525507","setting":{"urlCheck":false,"es6":true,"minified":true,"postcss":true},"usingComponents":true,"lazyCodeLoading":"requiredComponents","darkmode":true,"themeLocation":"theme.json"},"mp-alipay":{"appid":"wxd4e6c25454525507","setting":{"urlCheck":false,"es6":true,"minified":true,"postcss":true},"usingComponents":true,"lazyCodeLoading":"requiredComponents","darkmode":true,"themeLocation":"theme.json"},"uniStatistics":{"enable":false},"h5":{"darkmode":true,"themeLocation":"theme.json"},"vueVersion":"3","app-plus":{"darkmode":true,"distribute":{"ios":{"dSYMs":false},"sdkConfigs":{"ad":{}}}}}
2 changes: 1 addition & 1 deletion example/src/pages.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/src/pages/demo/business/invoice/index.vue
Expand Up @@ -102,7 +102,7 @@ export default {
<template>
<div class="demo full">
<h2 class="title">
默认用法
默认用法 (仅为组件示例,不会收集任何信息)
</h2>
<nut-invoice :data="data" :form-value="formValue" @onSubmit="submit" />
</div>
Expand Down
17 changes: 12 additions & 5 deletions example/src/pages/demo/dentry/calendar/index.vue
Expand Up @@ -285,18 +285,24 @@ export default {
<template #btn>
<view class="wrapper">
<view class="d_div">
<span class="d_btn" @click="goDate">去某个时间</span>
<view class="d_btn" @click="goDate">
去某个时间
</view>
</view>
<view class="d_div">
<span class="d_btn" @click="clickBtn">最近七天</span>
<view class="d_btn" @click="clickBtn">
最近七天
</view>
</view>
<view class="d_div">
<span class="d_btn" @click="clickBtn1">当月</span>
<view class="d_btn" @click="clickBtn1">
当月
</view>
</view>
</view>
</template>
<template #day="date">
<span>{{ date.date.day }}</span>
<view>{{ date.date.day }}</view>
</template>
</nut-calendar>
</div>
Expand Down Expand Up @@ -381,7 +387,8 @@ export default {
}
.wrapper {
display: flex;
padding: 0 40px;
padding: 10px 40px;
margin-top: 30px;
justify-content: center;
}
.d_div {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -18,6 +18,7 @@
"dev:mp-weixin": "npm -C example run dev:mp-weixin",
"build:mp-weixin": "npm -C example run build:mp-weixin",
"dev:mp-alipay": "npm -C example run dev:mp-alipay",
"build:mp-alipay": "npm -C example run build:mp-alipay",
"dev:h5": "npm -C example run dev:h5",
"build:h5": "npm -C example run build:h5",
"dev:app": "npm -C example run dev:app",
Expand Down
4 changes: 2 additions & 2 deletions packages/nutui/components/calendaritem/calendaritem.vue
Expand Up @@ -734,10 +734,10 @@ export default defineComponent({
<view class="nut-calendar__day" :class="getClass(day, month)" @click="chooseDay(day, month)">
<!-- 日期显示slot -->
<view class="nut-calendar__day-value">
<!-- #ifdef MP-WEIXIN -->
<!-- #ifdef MP -->
{{ day.type === 'curr' ? day.day : '' }}
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<!-- #ifndef MP -->
<slot name="day" :date="day.type === 'curr' ? day : ''">
{{ day.type === 'curr' ? day.day : '' }}
</slot>
Expand Down
2 changes: 1 addition & 1 deletion packages/nutui/components/calendaritem/index.scss
Expand Up @@ -121,7 +121,7 @@
text-align: center;
}

div:nth-of-type(2) {
view:nth-of-type(2) {
.nut-calendar__month-title {
padding-top: 0;
}
Expand Down
10 changes: 7 additions & 3 deletions packages/nutui/components/elevator/elevator.vue
Expand Up @@ -136,7 +136,9 @@ function listViewScroll(e: any) {
onMounted(() => {
props.indexList.forEach((item, index) => {
const query = uni.createSelectorQuery().in(instance).select(`#elevator__item__${index}`)
const query = uni.createSelectorQuery()
.in(instance)
.select(`#elevator__item__${index}`)
query.fields({
size: true,
scrollOffset: true,
Expand Down Expand Up @@ -192,7 +194,9 @@ export default defineComponent({
>
<view v-show="scrollY > 0 && isSticky" :style="fixedStyle" class="nut-elevator__list__fixed__wrapper">
<view v-if="isSticky" class="nut-elevator__list__fixed nut-elevator__list__fixed--mini">
<span class="nut-elevator__fixed-title">{{ indexList[currentIndex]?.[acceptKey] }}</span>
<text class="nut-elevator__fixed-title">
{{ indexList[currentIndex]?.[acceptKey] }}
</text>
</view>
</view>
<view id="elevator__item-wrap">
Expand All @@ -214,7 +218,7 @@ export default defineComponent({
}"
@click="handleClickItem(item[acceptKey], subitem)"
>
<span v-if="!$slots.default" v-html="subitem.name" />
<text v-if="!$slots.default" v-html="subitem.name" />
<slot v-else :item="subitem" />
</view>
</view>
Expand Down
4 changes: 3 additions & 1 deletion packages/nutui/components/ellipsis/ellipsis.vue
Expand Up @@ -245,7 +245,9 @@ export default defineComponent({
</view>
<view v-if="state.exceeded && state.expanded">
{{ content }}
<span v-if="expandText" class="nut-ellipsis__text" @click.stop="clickHandle(2)">{{ collapseText }}</span>
<view v-if="expandText" class="nut-ellipsis__text" @click.stop="clickHandle(2)">
{{ collapseText }}
</view>
</view>
</view>

Expand Down
4 changes: 3 additions & 1 deletion packages/nutui/components/input/input.vue
Expand Up @@ -221,7 +221,9 @@ export default defineComponent({
>
<view v-if="readonly" class="nut-input-disabled-mask" @click="onClickInput" />
<view v-if="showWordLimit && maxLength" class="nut-input-word-limit">
<span class="nut-input-word-num">{{ modelValue ? modelValue.length : 0 }}</span>/{{ maxLength }}
<text class="nut-input-word-num">
{{ modelValue ? modelValue.length : 0 }}
</text>/{{ maxLength }}
</view>
</view>
<view
Expand Down
5 changes: 2 additions & 3 deletions packages/nutui/components/menu/menu.vue
Expand Up @@ -157,7 +157,7 @@ export default defineComponent({
<view class="nut-menu__title-text">
{{ item.renderTitle() }}
</view>
<span class="nut-menu__title-icon">
<view class="nut-menu__title-icon">
<!-- #ifdef MP-WEIXIN -->
<Icon v-if="direction === 'up'" :name="upIcon" />
<Icon v-else :name="downIcon" />
Expand All @@ -168,8 +168,7 @@ export default defineComponent({
<Icon v-else name="rect-down" />
</slot>
<!-- #endif -->

</span>
</view>
</view>
</view>
</template>
Expand Down
4 changes: 2 additions & 2 deletions packages/nutui/components/menuitem/menuitem.vue
Expand Up @@ -193,7 +193,7 @@ export default defineComponent({
:style="{ 'flex-basis': `${100 / cols}%` }"
@click="onClick(option)"
>
<span
<view
v-if="option.value === modelValue"
class="nut-menu-item__span"
:class="[option.value === modelValue ? activeTitleClass : inactiveTitleClass]"
Expand All @@ -206,7 +206,7 @@ export default defineComponent({
<!-- #ifdef MP-WEIXIN -->
<Icon :name="optionIcon" :color="parent.props.activeColor" />
<!-- #endif -->
</span>
</view>
<view
:class="[option.value === modelValue ? activeTitleClass : inactiveTitleClass]"
:style="{ color: option.value === modelValue ? parent.props.activeColor : '' }"
Expand Down
8 changes: 5 additions & 3 deletions packages/nutui/components/numberkeyboard/numberkeyboard.vue
Expand Up @@ -141,9 +141,11 @@ export default defineComponent({
<h3 class="nut-number-keyboard__title">
{{ title }}
</h3>
<span v-if="type === 'default'" class="van-number-keyboard__close" @click="closeBoard()">{{
translate('done')
}}</span>
<text v-if="type === 'default'" class="van-number-keyboard__close" @click="closeBoard()">
{{
translate('done')
}}
</text>
</div>
<div class="nut-number-keyboard__body">
<div class="nut-number-keyboard__keys">
Expand Down
2 changes: 1 addition & 1 deletion packages/nutui/components/popup/popup.ts
Expand Up @@ -57,7 +57,7 @@ export type PopupProps = ExtractPropTypes<typeof popupProps>

export const popupEmits = {
'update:visible': (visible: boolean) => isBoolean(visible),
'click-pop': (evt: Event) => evt instanceof Object,
'click-pop': (evt?: any) => true,
'click-close-icon': () => true,
'open': () => true,
'close': () => true,
Expand Down
8 changes: 6 additions & 2 deletions packages/nutui/components/progress/progress.vue
Expand Up @@ -57,7 +57,9 @@ export default defineComponent({
background: textBackground || strokeColor,
}"
>
<span :style="textStyle">{{ percentage }}{{ isShowPercentage ? '%' : '' }}</span>
<view :style="textStyle">
{{ percentage }}{{ isShowPercentage ? '%' : '' }}
</view>
</div>
<div
v-if="showText && textInside && slotDefault"
Expand All @@ -75,7 +77,9 @@ export default defineComponent({
</div>
<div v-if="showText && !textInside" class="nut-progress-text" :style="{ lineHeight: height }">
<template v-if="status === 'text' || status === 'active'">
<span :style="textStyle">{{ percentage }}{{ isShowPercentage ? '%' : '' }} </span>
<view :style="textStyle">
{{ percentage }}{{ isShowPercentage ? '%' : '' }}
</view>
</template>
<template v-else-if="status === 'icon'">
<slot name="icon-name">
Expand Down
6 changes: 3 additions & 3 deletions packages/nutui/components/range/range.vue
Expand Up @@ -293,10 +293,10 @@ export default defineComponent({
<view :id="RangeID" :style="wrapperStyle" :class="classes" @click.stop="onClick">
<view class="nut-range-mark">
<template v-if="marksList.length > 0">
<span v-for="marks in marksList" :key="marks" :class="markClassName(marks)" :style="marksStyle(marks)">
<view v-for="marks in marksList" :key="marks" :class="markClassName(marks)" :style="marksStyle(marks)">
{{ marks }}
<span class="nut-range-tick" :style="tickStyle(marks)" />
</span>
<view class="nut-range-tick" :style="tickStyle(marks)" />
</view>
</template>
</view>
<view class="nut-range-bar" :style="barStyle">
Expand Down
4 changes: 2 additions & 2 deletions packages/nutui/components/sidenavbaritem/sidenavbaritem.vue
Expand Up @@ -47,9 +47,9 @@ export default defineComponent({

<template>
<view :class="classes" :style="[style]" :ikey="ikey" @click.stop="handleClick">
<span class="nut-side-navbar-item__title">
<text class="nut-side-navbar-item__title">
{{ title }}
</span>
</text>
</view>
</template>

Expand Down
6 changes: 4 additions & 2 deletions packages/nutui/components/step/step.vue
Expand Up @@ -71,11 +71,13 @@ export default defineComponent({
</view>
<view class="nut-step-main">
<view class="nut-step-title">
<span v-if="!$slots.title">{{ title }}</span>
<view v-if="!$slots.title">
{{ title }}
</view>
<slot name="title" />
</view>
<view v-if="content || $slots.content" class="nut-step-content">
<span v-if="!$slots.content" v-html="content" />
<view v-if="!$slots.content" v-html="content" />
<slot name="content" />
</view>
</view>
Expand Down
8 changes: 5 additions & 3 deletions packages/nutui/components/subsidenavbar/subsidenavbar.vue
Expand Up @@ -52,11 +52,13 @@ export default defineComponent({
<template>
<view :class="classes" :ikey="ikey">
<view class="nut-sub-side-navbar__title" :style="[paddingStyle]" @click.stop="handleClick">
<span class="nut-sub-side-navbar__title__text">{{ title }}</span>
<span class="nut-sub-side-navbar__title__icon">
<text class="nut-sub-side-navbar__title__text">
{{ title }}
</text>
<view class="nut-sub-side-navbar__title__icon">
<NutIcon v-if="!direction" custom-class="icon" name="arrow-down2" size="12px" />
<NutIcon v-else name="arrow-up2" size="12px" />
</span>
</view>
</view>
<view
v-show="!direction"
Expand Down
10 changes: 5 additions & 5 deletions packages/nutui/components/table/table.vue
Expand Up @@ -87,7 +87,7 @@ export default defineComponent({
<view class="nut-table__main" :class="{ 'nut-table__main--striped': striped }">
<view class="nut-table__main__head">
<view class="nut-table__main__head__tr">
<span
<view
v-for="item in columns"
:key="item.key"
class="nut-table__main__head__tr__th"
Expand All @@ -99,12 +99,12 @@ export default defineComponent({
<!-- <slot name="icon" > -->
<NutIcon v-if="item.sorter" name="down-arrow" size="12px" />
<!-- </slot> -->
</span>
</view>
</view>
</view>
<view class="nut-table__main__body">
<view v-for="item in state.curData" :key="item" class="nut-table__main__body__tr">
<span
<view
v-for="[value, render] in sortDataItem()"
:key="value as string"
class="nut-table__main__body__tr__td"
Expand All @@ -126,12 +126,12 @@ export default defineComponent({
{{ item[value as string] }}
</view>
<!-- #endif -->
</span>
</view>
</view>
</view>
</view>
<view v-if="summary" class="nut-table__summary">
<span class="nut-table__summary__text" v-html="summary().value" />
<view class="nut-table__summary__text" v-html="summary().value" />
</view>
<view v-if="!state.curData.length" class="nut-table__nodata">
<div class="nut-table__nodata" :class="{ 'nut-table__nodata--border': bordered }">
Expand Down

0 comments on commit 6fa5132

Please sign in to comment.