diff --git a/package.json b/package.json index b877ede..57db2ab 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "axios": "^1.3.2", "cheerio": "^1.0.0-rc.12", "moment": "^2.29.4", + "nzh": "^1.0.8", "vue": "^3.2.41" }, "devDependencies": { diff --git a/src/App.vue b/src/App.vue index 7581e88..96ce9c3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,14 +2,18 @@ import {darkTheme, useOsTheme} from "naive-ui"; import {computed, ref} from "vue"; import ReadHub from "./components/ReadHub.vue"; +import WeiboHot from "./components/WeiboHot.vue"; +import UseConfig from "./js/useConfig.js"; export default { - components: { ReadHub}, + components: {WeiboHot, ReadHub}, setup() { const osThemeRef = useOsTheme(); const loading = ref(false) + const {config} = UseConfig() return { loading, + config, theme: computed(() => osThemeRef.value === "dark" ? darkTheme : null), } } @@ -22,13 +26,14 @@ export default { - ReadHub + {{ config['source']['title'] }} - + + diff --git a/src/components/WeiboHot.vue b/src/components/WeiboHot.vue new file mode 100644 index 0000000..46ebb62 --- /dev/null +++ b/src/components/WeiboHot.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/src/js/useConfig.js b/src/js/useConfig.js index baf1f47..0c5d83b 100644 --- a/src/js/useConfig.js +++ b/src/js/useConfig.js @@ -1,15 +1,27 @@ import {ref} from "vue"; -function fetchConfig(){ +function fetchConfig() { } export default function () { const config = ref({ source: { - name: '' + title: '微博热搜', + name: 'weibohot', }, }) - const sources = ref() + const sources = ref( + [ + { + title: '微博热搜', + name: 'weibohot', + }, + { + title: 'ReadHub', + name: 'readhub', + }, + ] + ) return { sources,