File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
<script setup>
2
- import { ref } from ' vue' ;
2
+ import { ref , computed } from ' vue' ;
3
3
import CategorySecond from ' ../../components/CategorySecond.vue' ;
4
4
import { useRoute } from ' vue-router' ;
5
5
import {
6
- setTitle ,
7
6
requestGetJson ,
8
7
requestToYaml ,
9
8
handleCopyCodeSuccess
10
9
} from ' ../../utils/utils.js' ;
10
+ import { useHead } from ' @unhead/vue' ;
11
11
12
12
const mdRes = ref ();
13
13
const route = useRoute ();
14
14
const yamlDoc = ref ({});
15
15
const newsDate = ref (' ' );
16
+ useHead ({ title: computed (() => yamlDoc .value ? .title ) });
16
17
17
18
(async () => {
18
19
const newsPath = route .params .newsPath ;
19
20
newsDate .value = newsPath .substring (0 , 10 );
20
21
let [res, err] = await requestGetJson (` /news/${ newsPath} ` );
21
22
if (res) {
22
23
[mdRes .value , yamlDoc .value ] = requestToYaml (res);
23
- setTitle (yamlDoc .value [' title' ]);
24
24
} else if (err) {
25
25
console .log (err);
26
26
}
You can’t perform that action at this time.
0 commit comments