File tree Expand file tree Collapse file tree 5 files changed +29
-25
lines changed
Expand file tree Collapse file tree 5 files changed +29
-25
lines changed Original file line number Diff line number Diff line change 2525 "test" : " echo \" Error: run tests from root\" && exit 1"
2626 },
2727 "dependencies" : {
28+ "@vue/composition-api" : " ^1.0.0-beta.20" ,
2829 "vue" : " ^2.6.12" ,
2930 "vue-property-decorator" : " ^9.1.2"
3031 },
Original file line number Diff line number Diff line change 3636</template >
3737
3838<script >
39+ import { defineComponent , computed } from ' @vue/composition-api'
3940import { RecoIcon } from ' @vuepress-reco/core/lib/components'
4041import { getOneColor } from ' @theme/helpers/other'
4142
42- export default {
43+ export default defineComponent ( {
4344 components: { RecoIcon },
44- computed: {
45- homeBlogCfg () {
46- return this .$recoLocales .homeBlog
47- },
48- socialLinks () {
49- return this .$themeConfig .blogConfig .socialLinks .map (item => {
50- if (! item .color ) {
51- item .color = getOneColor ()
52- }
53- return item
54- })
55- }
45+ setup (props , ctx ) {
46+ const { root: _this } = ctx
47+
48+ const homeBlogCfg = computed (() => _this .$recoLocales .homeBlog )
49+ const socialLinks = computed (() => _this .$themeConfig .blogConfig .socialLinks .map (item => {
50+ if (! item .color ) item .color = getOneColor ()
51+ return item
52+ }))
53+
54+ return { homeBlogCfg, socialLinks }
5655 }
57- }
56+ })
5857 </script >
5958
6059<style lang="stylus" scoped>
Original file line number Diff line number Diff line change 1010</template >
1111
1212<script >
13+ import { defineComponent , computed } from ' @vue/composition-api'
1314import { getOneColor } from ' @theme/helpers/other'
1415
15- export default {
16+ export default defineComponent ( {
1617 props: {
1718 currentTag: {
1819 type: String ,
1920 default: ' '
2021 }
2122 },
22- computed: {
23- tags () {
24- return [{ name: this .$recoLocales .tag .all , path: ' /tag/' }, ... this .$tags .list ]
23+ setup (props , ctx ) {
24+ const { root: _this } = ctx
25+ const tags = computed (() => {
26+ return [{ name: _this .$recoLocales .tag .all , path: ' /tag/' }, ... _this .$tags .list ]
27+ })
28+ const tagClick = tag => {
29+ ctx .emit (' getCurrentTag' , tag)
2530 }
26- },
27- methods: {
28- tagClick (tag ) {
29- this .$emit (' getCurrentTag' , tag)
30- },
31- getOneColor
31+
32+ return { tags, tagClick, getOneColor }
3233 }
33- }
34+ })
3435 </script >
3536
3637<style lang="stylus" scoped>
Original file line number Diff line number Diff line change @@ -3,13 +3,15 @@ import postMixin from '@theme/mixins/posts'
33import localMixin from '@theme/mixins/locales'
44import { addLinkToHead , addScriptToHead } from '@theme/helpers/utils'
55import { registerCodeThemeCss , interceptRouterError } from '@theme/helpers/other'
6+ import VueCompositionAPI from '@vue/composition-api'
67
78export default ( {
89 Vue,
910 siteData,
1011 isServer,
1112 router
1213} ) => {
14+ Vue . use ( VueCompositionAPI )
1315 Vue . mixin ( postMixin )
1416 Vue . mixin ( localMixin )
1517 if ( ! isServer ) {
Original file line number Diff line number Diff line change 1919 "author" : " reco_luan" ,
2020 "main" : " index.js" ,
2121 "dependencies" : {
22+ "@vue/composition-api" : " ^1.0.0-beta.20" ,
2223 "@vuepress-reco/core" : " ^1.5.7" ,
2324 "@vuepress-reco/vuepress-plugin-back-to-top" : " ^1.5.7" ,
2425 "@vuepress-reco/vuepress-plugin-comments" : " ^1.5.7" ,
You can’t perform that action at this time.
0 commit comments