Skip to content

Commit

Permalink
feat:#13 发布到Vuepress-api模拟调用
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Jul 29, 2022
1 parent b49fc3e commit 24e0afe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/main/VuepressMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@
</template>

<script lang="ts" setup>
import {onBeforeMount} from "vue";
import {getPageId} from "../../lib/siyuan/siyuanUtil";
import {onBeforeMount, ref} from "vue";
import {getPageId, getPage} from "../../lib/siyuan/siyuanUtil";
import log from "../../lib/logUtil"
const isPublished = false
const formData = {
title: "",
customSlug: "",
customSlug: ref(""),
desc: "",
created: new Date(),
checkList: [],
Expand Down Expand Up @@ -201,6 +201,8 @@ onBeforeMount(async () => {
if (!pageId || pageId == "") {
return
}
const page = await getPage(pageId)
log.logWarn("VuepressMain获取主文档", page)
})
</script>

Expand Down
3 changes: 3 additions & 0 deletions src/lib/siyuan/siYuanApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export {

async function 向思源请求数据(url: string, data: any) {
let resData = null
if (config.baseUrl != "") {
url = config.baseUrl + url
}
await fetch(url, {
body: JSON.stringify(data),
method: 'POST',
Expand Down
1 change: 1 addition & 0 deletions src/lib/siyuan/siYuanConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
import {getEnv} from "../envUtil";

export const config = {
baseUrl: import.meta.env.DEV ? "http://127.0.0.1:6806" : "",// Base Url,开发阶段需要填写
token: getEnv("VITE_SIYUAN_CONFIG_TOKEN"), // API token, 无需填写
};

0 comments on commit 24e0afe

Please sign in to comment.