Skip to content

Commit

Permalink
feat(tab): 支持vue3
Browse files Browse the repository at this point in the history
  • Loading branch information
novlan1 committed Jul 18, 2024
1 parent 4cd4d45 commit e1941f0
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 192 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "press-ui",
"version": "2.0.8",
"version": "2.0.9",
"description": "简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目",
"private": true,
"repository": {
Expand Down
30 changes: 30 additions & 0 deletions packages/press-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [2.0.9](https://github.com/novlan1/press-ui/compare/v2.0.8...v2.0.9) (2024-07-18)


### ✅ Tests | 测试

* update snapshot ([3f7c629](https://github.com/novlan1/press-ui/commit/3f7c629b3fa62ce5054f782f6d6b324fa647cec6))


### 🚀 Chore | 构建/工程依赖/工具

* 优化demo ([792c8c5](https://github.com/novlan1/press-ui/commit/792c8c54d677ec0b6e281430dd88aecd802fb4fd))
* eslint disable async-validator ([319dd5a](https://github.com/novlan1/press-ui/commit/319dd5a901bec12b83c1f8c1c924397add967fd3))
* remove useless comment ([ac08e9b](https://github.com/novlan1/press-ui/commit/ac08e9b2346790e3da6f157ec6027f52eb23b5f3))
* update index page ([ba9d930](https://github.com/novlan1/press-ui/commit/ba9d930560d942edccca2f494c8af0af95cd8b85))


### ♻️ Code Refactoring | 代码重构

* **cell:** 兼容vue3打包 ([2519724](https://github.com/novlan1/press-ui/commit/2519724a0cc265fe367d28863e0c4a01f9f77f22))
* **popover-plus:** 兼容vue3打包 ([1f18775](https://github.com/novlan1/press-ui/commit/1f18775dfb1c1ceb8c1c25dc53f9fe9a000f2437))


### ✨ Features | 新功能

* **cell:** h5下增加cursor: pointer, 优化collapse ([524d341](https://github.com/novlan1/press-ui/commit/524d34184575bdfa336792daec3369986e1a6bb7))
* **checkbox:** 点击事件阻止冒泡 ([061e732](https://github.com/novlan1/press-ui/commit/061e73213644de1f8974502027168c1ee5123c30))
* **collapse:** 增加 default-expand-all 属性 ([56409c5](https://github.com/novlan1/press-ui/commit/56409c55d41e79ae2ecd29e8fdc81ca44c38b159))
* **pull-refresh:** 支持vue3 ([99f811d](https://github.com/novlan1/press-ui/commit/99f811ddeebc891efaf5a201d1dd041102b85794))
* **relation:** 支持vue3,组件销毁时更新 ([11bb0ae](https://github.com/novlan1/press-ui/commit/11bb0aeb037dc3c08851add13e190c7f2e8111f2))

### [2.0.8](https://github.com/novlan1/press-ui/compare/v2.0.7...v2.0.8) (2024-07-15)


Expand Down
30 changes: 30 additions & 0 deletions packages/press-ui/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# 更新日志

### [2.0.9](https://github.com/novlan1/press-ui/compare/v2.0.8...v2.0.9) (2024-07-18)


### Tests ✅

* update snapshot ([3f7c629](https://github.com/novlan1/press-ui/commit/3f7c629b3fa62ce5054f782f6d6b324fa647cec6))


### Chore 🚀

* 优化demo ([792c8c5](https://github.com/novlan1/press-ui/commit/792c8c54d677ec0b6e281430dd88aecd802fb4fd))
* eslint disable async-validator ([319dd5a](https://github.com/novlan1/press-ui/commit/319dd5a901bec12b83c1f8c1c924397add967fd3))
* remove useless comment ([ac08e9b](https://github.com/novlan1/press-ui/commit/ac08e9b2346790e3da6f157ec6027f52eb23b5f3))
* update index page ([ba9d930](https://github.com/novlan1/press-ui/commit/ba9d930560d942edccca2f494c8af0af95cd8b85))


### Code Refactoring ♻️

* **cell:** 兼容vue3打包 ([2519724](https://github.com/novlan1/press-ui/commit/2519724a0cc265fe367d28863e0c4a01f9f77f22))
* **popover-plus:** 兼容vue3打包 ([1f18775](https://github.com/novlan1/press-ui/commit/1f18775dfb1c1ceb8c1c25dc53f9fe9a000f2437))


### Features 🎉

* **cell:** h5下增加cursor: pointer, 优化collapse ([524d341](https://github.com/novlan1/press-ui/commit/524d34184575bdfa336792daec3369986e1a6bb7))
* **checkbox:** 点击事件阻止冒泡 ([061e732](https://github.com/novlan1/press-ui/commit/061e73213644de1f8974502027168c1ee5123c30))
* **collapse:** 增加 default-expand-all 属性 ([56409c5](https://github.com/novlan1/press-ui/commit/56409c55d41e79ae2ecd29e8fdc81ca44c38b159))
* **pull-refresh:** 支持vue3 ([99f811d](https://github.com/novlan1/press-ui/commit/99f811ddeebc891efaf5a201d1dd041102b85794))
* **relation:** 支持vue3,组件销毁时更新 ([11bb0ae](https://github.com/novlan1/press-ui/commit/11bb0aeb037dc3c08851add13e190c7f2e8111f2))

### [2.0.8](https://github.com/novlan1/press-ui/compare/v2.0.7...v2.0.8) (2024-07-15)


Expand Down
2 changes: 1 addition & 1 deletion packages/press-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "press-ui",
"version": "2.0.8",
"version": "2.0.9",
"description": "简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目",
"private": true,
"repository": {
Expand Down
22 changes: 17 additions & 5 deletions packages/press-ui/src/packages/mixins/relation.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ export function ChildrenMixin(parent, options = {}) {
// #endif
},

// #ifdef VUE2
beforeDestroy() {
const that = this;
if (that[parent]) {
that[parent].children = that[parent].children.filter(item => item !== that);

that?.destroyCallback?.();
}
that.onBeforeMount();
},
// #endif
// #ifdef VUE3
beforeUnmount() {
const that = this;
that.onBeforeMount();
},
// #endif

methods: {
bindRelation() {
Expand All @@ -91,6 +95,14 @@ export function ChildrenMixin(parent, options = {}) {

this[parent].children = children;
},
onBeforeMount() {
const that = this;
if (that[parent]) {
that[parent].children = that[parent].children.filter(item => item !== that);

that?.destroyCallback?.();
}
},
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/press-ui/src/packages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "press-ui",
"version": "2.0.8",
"version": "2.0.9",
"description": "简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目",
"main": "index.js",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/press-ui/src/packages/press-back-top/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ export default {
this.valueMap[key] = value;
},
onScroll(e) {
this.scrollTop = e.target.scrollTop;
console.log('[scrollTop]', this.scrollTop);
this.scrollTop = e.target.scrollTop ?? e.detail.scrollTop;
console.log('[scrollTop]', e, this.scrollTop);
},
scrollToTop() {
that.newScrollTop = that.scrollTop;
Expand Down
5 changes: 5 additions & 0 deletions packages/press-ui/src/packages/press-cell/css/h5.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* #ifdef H5 */
.press-cell--clickable {
cursor: pointer;
}
/* #endif */
6 changes: 0 additions & 6 deletions packages/press-ui/src/packages/press-cell/css/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@
line-height: var(--cell-line-height, $cell-line-height);
}

&--clickable {
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}

// 【修改点】 &--clickable&--hover不能用
&--clickable.press-cell--hover,
&--clickable:active {
Expand Down
2 changes: 2 additions & 0 deletions packages/press-ui/src/packages/press-cell/press-cell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,5 @@ export default {
</script>
<style scoped lang="scss" src="./css/index.scss">
</style>
<style scoped lang="scss" src="./css/h5.scss">
</style>
51 changes: 27 additions & 24 deletions packages/press-ui/src/packages/press-form/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
:readonly="isMp"
@click-input="showSex = true; hideKeyboard()"
/>
<PressIconPlus
slot="right"
name="arrow"
/>
<template #right>
<PressIconPlus
name="arrow"
/>
</template>
</PressFormItem>

<PressFormItem
ref="item2"
label="水果"
Expand Down Expand Up @@ -115,27 +117,28 @@
:border="false"
placeholder="请填写验证码"
/>
<PressButton
slot="right"
type="primary"
size="mini"
:disabled="disabled1"
@click="getCode"
>
<press-count-down
use-slot
:time="time"
@change="onChangeTime"
<template #right>
<PressButton
type="primary"
size="mini"
:disabled="disabled1"
@click="getCode"
>
<span class="countdown-wrap">
<template v-if="!Object.keys(timeData).length">获取信息</template>
<template v-else-if="timeData.seconds <= 0">重新获取</template>
<template v-else>
<span class="item">{{ timeData.seconds }}</span><span>秒重新获取</span>
</template>
</span>
</press-count-down>
</PressButton>
<press-count-down
use-slot
:time="time"
@change="onChangeTime"
>
<span class="countdown-wrap">
<template v-if="!Object.keys(timeData).length">获取信息</template>
<template v-else-if="timeData.seconds <= 0">重新获取</template>
<template v-else>
<span class="item">{{ timeData.seconds }}</span><span>秒重新获取</span>
</template>
</span>
</press-count-down>
</PressButton>
</template>
</PressFormItem>
</PressForm>

Expand Down
138 changes: 138 additions & 0 deletions packages/press-ui/src/packages/press-popover-plus/css/h5.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
@import "../../common/style/press/var.scss";


/* #ifdef H5 */
.press-popover--custom-container {
&[data-popper-placement^='top'] {
.press-popover__arrow {
bottom: 0;
border-top-color: currentColor;
border-bottom-width: 0;
transform: translate(-50%, 100%);
}
}

&[data-popper-placement='top'] {
transform-origin: 50% 100%;

.press-popover__arrow {
left: 50%;
}
}

&[data-popper-placement='top-start'] {
transform-origin: 0 100%;

.press-popover__arrow {
left: $padding-md;
}
}

&[data-popper-placement='top-end'] {
transform-origin: 100% 100%;

.press-popover__arrow {
right: $padding-md;
}
}

&[data-popper-placement^='left'] {
.press-popover__arrow {
right: 0;
border-right-width: 0;
border-left-color: currentColor;
transform: translate(100%, -50%);
}
}

&[data-popper-placement='left'] {
transform-origin: 100% 50%;

.press-popover__arrow {
top: 50%;
}
}

&[data-popper-placement='left-start'] {
transform-origin: 100% 0;

.press-popover__arrow {
top: $padding-md;
}
}

&[data-popper-placement='left-end'] {
transform-origin: 100% 100%;

.press-popover__arrow {
bottom: $padding-md;
}
}

&[data-popper-placement^='right'] {
.press-popover__arrow {
left: 0;
border-right-color: currentColor;
border-left-width: 0;
transform: translate(-100%, -50%);
}
}

&[data-popper-placement='right'] {
transform-origin: 0 50%;

.press-popover__arrow {
top: 50%;
}
}

&[data-popper-placement='right-start'] {
transform-origin: 0 0;

.press-popover__arrow {
top: $padding-md;
}
}

&[data-popper-placement='right-end'] {
transform-origin: 0 100%;

.press-popover__arrow {
bottom: $padding-md;
}
}

&[data-popper-placement^='bottom'] {
.press-popover__arrow {
top: 0;
border-top-width: 0;
border-bottom-color: currentColor;
transform: translate(-50%, -100%);
}
}

&[data-popper-placement='bottom'] {
transform-origin: 50% 0;

.press-popover__arrow {
left: 50%;
}
}

&[data-popper-placement='bottom-start'] {
transform-origin: 0 0;

.press-popover__arrow {
left: $padding-md;
}
}

&[data-popper-placement='bottom-end'] {
transform-origin: 100% 0;

.press-popover__arrow {
right: $padding-md;
}
}
}
/* #endif */
Loading

0 comments on commit e1941f0

Please sign in to comment.