This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
import { | |
value, | |
watch, | |
computed, | |
onMounted, | |
onUnmounted | |
} from 'vue-function-api' | |
import { fetchUserPosts } from '@/api' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
import { | |
value, | |
watch, | |
computed, | |
onMounted, | |
onUnmounted | |
} from 'vue-function-api' | |
import { fetchUserPosts } from '@/api' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
import { value, onMounted, onUnmounted } from 'vue-function-api' | |
export default { | |
setup(props) { | |
const pageOffset = value(0) | |
const update = () => { | |
pageOffset.value = window.pageYOffset | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
import { value } from 'vue-function-api' | |
const TestComponent = { | |
props: { | |
name: String | |
}, | |
setup(props) { | |
const message = value('Hello guest!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
export default { | |
setup(props) { | |
const pageOffset = 0 | |
return { | |
pageOffset | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
export default { | |
name: 'PostsPage', | |
mixins: [scrollMixin, mouseMixin], | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const withPostsHOC = WrappedComponent => ({ | |
props: WrappedComponent.props, // ['posts', ...] | |
data() { | |
return { | |
postsIsLoading: false, | |
posts: [] // fetchedPosts -> posts | |
} | |
}, | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
export default { | |
name: 'PostsPage', | |
mixins: [scrollMixin], | |
props: { | |
id: Number, | |
isLoading: Boolean, | |
posts: Array, | |
count: Number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<script> | |
export default { | |
name: 'PostsPage', | |
mixins: [scrollMixin], | |
props: { | |
id: Number, | |
isLoading: Boolean, | |
posts: Array, | |
count: Number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fetchUserPosts } from '@/api' | |
const withPostsHOC = WrappedComponent => ({ | |
props: WrappedComponent.props, | |
data() { | |
return { | |
postsIsLoading: false, | |
fetchedPosts: [] | |
} | |
}, |
NewerOlder