* [bug] need to restore the scroll position when direction is top#184
* [bug] need to restore the scroll position when direction is top#184snowyu wants to merge 17 commits intoPeachScript:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #184 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 2 2
Lines 106 124 +18
Branches 25 31 +6
=====================================
+ Hits 106 124 +18
Continue to review full report at Codecov.
|
|
Known Issue:
|
|
Ok, I've found the height must be exists in the old browser if you wanna work around above issues. |
|
@snowyu thanks for these detailed contributions and full tests! I have some questions and suggestions for these commit, please don't mind if there has something wrong:
|
The
Use the vue-class-component, you can write component more pretty. import InfiniteLoading, { StateChanger } from 'vue-infinite-loading';
@Component({
components: { ChatRoomInfo, InfiniteLoading }
})
export default class ChatRoom extends Vue {
loadMore($state: StateChanger) {
console.log('loadMore')
if (++this.count > 5) return $state.complete();
...
this.$nextTick(()=>$state.loaded());
}
}
Yes, I'd searched a long time too, but found little. You can try it on the android emulator (such as API 19). The <template lang="pug">
div(style="width: 100%; max-width: 96vw;")
q-scroll-area(ref="scrollWrapper" style="height: calc(100vh);")
infinite-loading(
@infinite="loadMore" direction="top" :distance="0" infinite-wrapper-class="scroll"
:top-scroll-pos="10"
)
q-chat-message(
v-for="(msg, index) in messages"
:key="`reg-${index}`"
:label="msg.label"
:sent="msg.sent"
:text-color="msg.textColor"
:bg-color="msg.bgColor"
:name="msg.name"
:avatar="msg.avatar"
:text="msg.text"
:stamp="msg.stamp"
)
</template>
|
|
BTW: You can use this as typescript starter to test: https://github.com/snowyu/quasar-ts-seed. |
|
@snowyu thanks for your explanation and glad you like this project! For the And I tried to use I will check the |
And maybe we need the similar
2.1 V2.3.3 // used in npm repository.
export = InfiniteLoading;https://www.typescriptlang.org/docs/handbook/modules.html
This is not a ts way. So you must enable 2.2 master branch // used in master branch
export default InfiniteLoading;This only exports the And the InfiniteLoading namespace(internal module name) is the same with class name confused me: What is really exported, namespace or class? BTW: I suggest you try the vue-test-utils with jest to test. It has a cool vscode plugin: https://github.com/jest-community/vscode-jest |
|
Forget |
I will try the |
This only exports the InfiniteLoading class. not the StateChanger etc in the namespace. |
|
BTW I add a chat demo to my quasar-ts-starter-seed |
Hi, I improved types definition and send a PR just now, could you please review this change? |
Sorry, missed changes from your PR, it has already been improved. |
|
@snowyu so efficient work! Could you create another PR only contains the About the TypeScript definition, I try to search in the official documentation, I think the StateChanger also be exported through the declaration-merging feature, is that right? |
|
About the TypeScript definition just try my demo after changing this line. //package.json
//"vue-infinite-loading": "github:snowyu/vue-infinite-loading",
"vue-infinite-loading": "github:PeachScript/vue-infinite-loading",first u should install quasar-cli : then run it: You should get the error: ERROR Failed to compile with 1 errors 9:26:07 PM
error in quasar-ts-seed/src/components/ChatMessages.vue.ts
[tsl] ERROR in quasar-ts-seed/src/components/ChatMessages.vue.ts(25,27)
TS2305: Module '"quasar-ts-seed/node_modules/vue-infinite-loading/types/index"' has no exported member 'StateChanger'. |
|
@snowyu I have been reproduced this problem with TypeScript-Vue-Starter, but when I use |
|
The |
|
read here carefullly: #184 (comment) |
|
Oh sorry I missed it, thanks for your patience! It would be better if you can create another PR about the TypeScript definition fixes :P And I plan to release a new version contains the |
|
The Best Regards |
Sorry I am too lazy to split them. So all in it.