Skip to content

Commit 54063b2

Browse files
author
liyuan97
committed
chore: inital test
1 parent 226ca4f commit 54063b2

File tree

19 files changed

+470
-421
lines changed

19 files changed

+470
-421
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,8 @@ jobs:
3636
if: steps.npm-cache.outputs.cache-hit != 'true'
3737
run: yarn --frozen-lockfile
3838
# 运行构建脚本
39-
# - uses: webfactory/[email protected]
40-
# with:
41-
# ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
42-
# - name: Install dependencies
43-
# run: yarn install --frozen-lockfile
4439
- name: run build script
45-
run: yarn docs:build
40+
run: yarn build
4641
# 部署
4742
- name: deploy
4843
uses: JamesIves/github-pages-deploy-action@v4

docs/.vuepress/client.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineClientConfig } from '@vuepress/client'
2+
// import Layout from './theme/components/SidebarAnchor.vue'
3+
import HomeLayout from './theme/components/Home.vue'
4+
// import microApp from '@micro-zoe/micro-app'
5+
6+
// microApp.start()
7+
8+
export default defineClientConfig({
9+
layouts: {
10+
// Layout,
11+
HomeLayout
12+
}
13+
})

docs/.vuepress/config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ export default defineUserConfig({
1616
title: 'MicroApp',
1717
description: '一款简约、高效、功能强大的微前端框架',
1818
head: [['link', { rel: 'icon', href: '/images/logo.png' }]],
19-
bundler: viteBundler(),
19+
bundler: viteBundler({
20+
vuePluginOptions: {
21+
template: {
22+
compilerOptions: {
23+
isCustomElement: (tag) => tag.startsWith('micro-app')
24+
}
25+
}
26+
}
27+
}),
2028
base: '/micro-app-docs/',
2129
theme: microAppTheme({
2230
logo: '/images/logo.png',

docs/.vuepress/public/images/logo.png

1.67 KB
Loading

docs/.vuepress/theme/components/Home.vue

Lines changed: 67 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import {
55
useSiteLocaleData,
66
} from '@vuepress/client'
77
import type { DefaultThemeHomePageFrontmatter } from '@vuepress/theme-default'
8-
import "../home/js/micro-app-loading.js"
9-
import "../home/js/iconfont.js"
8+
// import MicroAppLoading from '../home/components/microapploading.vue'
109
1110
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
1211
const siteLocale = useSiteLocaleData()
12+
const base = siteLocale.value.base
13+
14+
console.log('base', base)
1315
1416
const heroText = computed(() => {
1517
if (frontmatter.value.heroText === null) {
@@ -42,61 +44,61 @@ const loadingConTwo = ref(true)
4244
4345
4446
onMounted(() => {
45-
const observer1 = new IntersectionObserver(([{ intersectionRatio }]) => {
46-
if (intersectionRatio <= 0) return
47-
observer1.disconnect()
48-
showContentOneImg.value = true
47+
// const observer1 = new IntersectionObserver(([{ intersectionRatio }]) => {
48+
// if (intersectionRatio <= 0) return
49+
// observer1.disconnect()
50+
// showContentOneImg.value = true
4951
50-
setTimeout(() => { loadingConOne.value = false}, 1100)
52+
// setTimeout(() => { loadingConOne.value = false}, 1100)
5153
52-
// <micro-app-loading size='0.3' class="loading-logo"></micro-app-loading>
53-
setTimeout(() => {
54-
const myApp = document.createElement('micro-app') as HTMLElement
55-
myApp.setAttribute('name', 'my-app1')
56-
myApp.setAttribute('disable-memory-router', 'true')
57-
myApp.setAttribute('url', `https://zeroing.jd.com/micro-app/react17/`)
58-
myApp.addEventListener('mounted', () => {
59-
microAppConOne.value?.removeChild(microAppConOne.value.children[0])
60-
})
61-
microAppConOne.value?.appendChild(myApp)
62-
}, 3000)
63-
})
54+
// // <micro-app-loading size='0.3' class="loading-logo"></micro-app-loading>
55+
// setTimeout(() => {
56+
// const myApp = document.createElement('micro-app') as HTMLElement
57+
// myApp.setAttribute('name', 'my-app1')
58+
// myApp.setAttribute('disable-memory-router', 'true')
59+
// myApp.setAttribute('url', `https://zeroing.jd.com/micro-app/react17/`)
60+
// myApp.addEventListener('mounted', () => {
61+
// microAppConOne.value?.removeChild(microAppConOne.value.children[0])
62+
// })
63+
// microAppConOne.value?.appendChild(myApp)
64+
// }, 3000)
65+
// })
6466
65-
observer1.observe(contentOneImg.value as Element)
67+
// observer1.observe(contentOneImg.value as Element)
6668
67-
const observer2 = new IntersectionObserver(([{ intersectionRatio }]) => {
68-
if (intersectionRatio <= 0) return
69-
observer2.disconnect()
70-
showContentTwoImg.value = true
71-
})
69+
// const observer2 = new IntersectionObserver(([{ intersectionRatio }]) => {
70+
// if (intersectionRatio <= 0) return
71+
// observer2.disconnect()
72+
// showContentTwoImg.value = true
73+
// })
7274
73-
observer2.observe(contentTwoImg1.value as Element)
75+
// observer2.observe(contentTwoImg1.value as Element)
7476
75-
const observer3 = new IntersectionObserver(([{ intersectionRatio }]) => {
76-
if (intersectionRatio <= 0) return
77-
observer3.disconnect()
78-
showContentTwoImg2.value = true
77+
// const observer3 = new IntersectionObserver(([{ intersectionRatio }]) => {
78+
// if (intersectionRatio <= 0) return
79+
// observer3.disconnect()
80+
// showContentTwoImg2.value = true
7981
80-
setTimeout(() => { loadingConTwo.value = false }, 1100)
82+
// setTimeout(() => { loadingConTwo.value = false }, 1100)
8183
82-
setTimeout(() => {
83-
const myApp = document.createElement('micro-app')
84-
myApp.setAttribute('name', 'my-app2')
85-
myApp.setAttribute('url', `https://zeroing.jd.com/micro-app/react17/`)
86-
myApp.setAttribute('disable-memory-router', 'true')
87-
myApp.addEventListener('mounted', () => {
88-
microAppConTwo.value?.removeChild(microAppConTwo.value?.children[0])
89-
})
90-
microAppConTwo.value?.appendChild(myApp)
91-
}, 3000);
92-
})
93-
observer3.observe(contentTwoImg2.value as Element)
84+
// setTimeout(() => {
85+
// const myApp = document.createElement('micro-app')
86+
// myApp.setAttribute('name', 'my-app2')
87+
// myApp.setAttribute('url', `https://zeroing.jd.com/micro-app/react17/`)
88+
// myApp.setAttribute('disable-memory-router', 'true')
89+
// myApp.addEventListener('mounted', () => {
90+
// microAppConTwo.value?.removeChild(microAppConTwo.value?.children[0])
91+
// })
92+
// microAppConTwo.value?.appendChild(myApp)
93+
// }, 3000);
94+
// })
95+
// observer3.observe(contentTwoImg2.value as Element)
9496
95-
onBeforeUnmount(() => {
96-
observer1.disconnect()
97-
observer2.disconnect()
98-
observer3.disconnect()
99-
})
97+
// onBeforeUnmount(() => {
98+
// observer1.disconnect()
99+
// observer2.disconnect()
100+
// observer3.disconnect()
101+
// })
100102
})
101103
</script>
102104

@@ -111,10 +113,10 @@ onMounted(() => {
111113
</a>
112114
</div>
113115
<nav class='header-nav'>
114-
<a class='header-nav-title' href="/zh/">文档</a>
115-
<a class='header-nav-title' href="/v0/zh/">0.x文档</a>
116+
<a class='header-nav-title' :href="base + 'zh/'">文档</a>
117+
<a class='header-nav-title' :href="base + 'v0/zh/'">0.x文档</a>
116118
<a class='header-nav-title' href="https://zeroing.jd.com/micro-app/demo/" target="blank">示例</a>
117-
<a class='header-nav-title' href="/zh/micro-app-devtools">Micro-App-DevTools</a>
119+
<a class='header-nav-title' :href="base + 'zh/micro-app-devtools'">Micro-App-DevTools</a>
118120
<a class='header-nav-title' href="https://github.com/micro-zoe/micro-app" target="blank"><img
119121
class='github-icon' src="../home/assets/github-logo.png" alt="github"></a>
120122
</nav>
@@ -123,7 +125,7 @@ onMounted(() => {
123125
<div v-if="heroText" class='introduce-title'>{{ heroText }}</div>
124126
<p v-if="tagline" class='introduce-desc'>{{ tagline }}</p>
125127
<div class="introduce-btn-list">
126-
<a href="/zh/" class='btn-start'>开始使用</a>
128+
<a :href="base + 'zh/'" class='btn-start'>开始使用</a>
127129
<a href="https://zeroing.jd.com/micro-app/demo/" class='btn-coding' target="blank">在线案例</a>
128130
</div>
129131
</section>
@@ -158,7 +160,7 @@ onMounted(() => {
158160
src="../home/assets/arrow-right.png" alt="">
159161
<div class='micro-app-con micro-app-con-one' :class="{ 'micro-app-con-show': showContentOneImg }"
160162
ref="microAppConOne">
161-
<micro-app-loading size='0.3' class="loading-logo" :class="{ hidden: loadingConOne }"></micro-app-loading>
163+
<!-- <micro-app-loading size='0.3' class="loading-logo" :class="{ hidden: loadingConOne }"></micro-app-loading> -->
162164
</div>
163165
</div>
164166
</section>
@@ -192,59 +194,45 @@ onMounted(() => {
192194
<div class="ability-list-cont">
193195
<div class="ability-item">
194196
<div class="ability-item-icon-con">
195-
<svg class="icon ability-icon-sandbox" aria-hidden="true">
196-
<use xlink:href="#icon-sandbox"></use>
197-
</svg>
197+
<span class="microdocs icon-codesandbox" />
198198
</div>
199199
<h4>JS沙箱</h4>
200200
</div>
201201
<div class="ability-item">
202202
<div class="ability-item-icon-con ability-item-icon-css">
203-
<svg class="icon ability-icon-css" aria-hidden="true">
204-
<use xlink:href="#icon-css"></use>
205-
</svg>
206-
<svg class="icon ability-icon-css" aria-hidden="true">
207-
<use xlink:href="#icon-css"></use>
208-
</svg>
203+
<span class="microdocs icon-css ability-icon-css" />
204+
<span class="microdocs icon-css ability-icon-css" />
209205
</div>
210206
<h4>样式隔离</h4>
211207
</div>
212208
<div class="ability-item">
213209
<div class="ability-item-icon-con ability-item-icon-element">
214-
<svg class="icon ability-icon-element" aria-hidden="true">
215-
<use xlink:href="#icon-element"></use>
216-
</svg>
210+
<span class="microdocs icon-element" />
217211
</div>
218212
<h4>元素隔离</h4>
219213
</div>
220214
<div class="ability-item">
221215
<div class="ability-item-icon-con ability-item-icon-tongxun">
222-
<svg class="icon ability-icon-tongxun" aria-hidden="true">
223-
<use xlink:href="#icon-tongxun"></use>
224-
</svg>
216+
<span class="microdocs icon-tongxun" />
225217
</div>
226218
<h4>数据通信</h4>
227219
</div>
228220
<div class="ability-item">
229221
<div class="ability-item-icon-con ability-item-icon-plugin">
230-
<svg class="icon ability-icon-plugin" aria-hidden="true">
231-
<use xlink:href="#icon-plugin"></use>
232-
</svg>
222+
<span class="microdocs icon-plugin" />
233223
</div>
234224
<h4>插件系统</h4>
235225
</div>
236226
<div class="ability-item">
237227
<div class="ability-item-icon-con ability-item-icon-prefetch">
238-
<svg class="icon ability-icon-prefetch" aria-hidden="true">
239-
<use xlink:href="#icon-prefetch"></use>
240-
</svg>
228+
<span class="microdocs icon-prefetch" />
241229
</div>
242230
<h4>预加载</h4>
243231
</div>
244232
</div>
245233
</section>
246234
<div class="content-thrid-btn">
247-
<a href="/zh/" class='btn-start'>快速开始</a>
235+
<a :href="base + 'zh/'" class='btn-start'>快速开始</a>
248236
</div>
249237
</section>
250238
<footer class="footer">
@@ -265,8 +253,10 @@ onMounted(() => {
265253
</dd>
266254
</dl>
267255
</div>
268-
</footer>
269-
</main></template>
256+
</footer>
257+
</main>
258+
</template>
270259

271260
<style src="../home/css/index.css" scoped></style>
272261
<style src="../home/css/animation.css" scoped></style>
262+
<style src="../home/fonts/iconfont.css" scoped></style>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineCustomElement } from 'vue'
2+
import MicroAppLoadingEle from './MicroAppLoading.vue'
3+
4+
const MicroAppLoading = defineCustomElement(MicroAppLoadingEle)
5+
6+
if (!customElements.get('micro-app-loading')) {
7+
customElements.define('micro-app-loading', MicroAppLoading)
8+
}

0 commit comments

Comments
 (0)