404
5 |{{ getMsg() }}6 |
├── CHANGELOG.md ├── lib ├── app │ ├── .temp │ │ ├── override.styl │ │ ├── style.styl │ │ ├── enhanceApp.js │ │ └── themeEnhanceApp.js │ ├── store.js │ ├── root-mixins │ │ ├── index.js │ │ ├── activeHeaderLinks.js │ │ └── updateMeta.js │ ├── index.dev.html │ ├── components │ │ ├── ClientOnly.js │ │ ├── Content.js │ │ ├── OutboundLink.vue │ │ └── Badge.vue │ ├── serverEntry.js │ ├── util.js │ ├── index.ssr.html │ ├── SWUpdateEvent.js │ └── clientEntry.js ├── noop.js ├── webpack │ ├── noopModule.js │ ├── HeadPlugin.js │ ├── DevLogPlugin.js │ ├── createServerConfig.js │ └── createClientConfig.js ├── default-theme │ ├── styles │ │ ├── toc.styl │ │ ├── wrapper.styl │ │ ├── config.styl │ │ ├── arrow.styl │ │ ├── custom-blocks.styl │ │ ├── mobile.styl │ │ └── nprogress.styl │ ├── search.svg │ ├── NotFound.vue │ ├── DropdownTransition.vue │ ├── SidebarButton.vue │ ├── NavLink.vue │ ├── SidebarGroup.vue │ └── SWUpdatePopup.vue ├── index.js ├── util │ ├── shared.js │ ├── logger.js │ ├── parseHeaders.js │ └── index.js ├── service-worker │ └── skip-waiting.js ├── markdown │ ├── hoist.js │ ├── preWrapper.js │ ├── slugify.js │ ├── lineNumbers.js │ ├── containers.js │ ├── highlight.js │ ├── snippet.js │ ├── highlightLines.js │ └── index.js ├── eject.js └── prepare │ ├── loadConfig.js │ ├── index.js │ ├── codegen.js │ └── util.js ├── docs ├── assets │ ├── css │ │ ├── 7.styles.c8b06cc2.css │ │ ├── 4.styles.4c7ddd69.css │ │ ├── 6.styles.7081061c.css │ │ ├── 3.styles.e7495a9d.css │ │ ├── 5.styles.d250c3e3.css │ │ ├── 2.styles.58c85033.css │ │ └── 1.styles.445f32b6.css │ ├── js │ │ ├── 7.c8b06cc2.js │ │ ├── 1.445f32b6.js │ │ ├── 2.58c85033.js │ │ ├── 53.49d814c3.js │ │ ├── 8.928a4419.js │ │ ├── 48.9e2f6119.js │ │ ├── 64.4b0c2825.js │ │ ├── 50.6ea8d75d.js │ │ ├── 35.0d7b47e4.js │ │ ├── 49.ebed9df6.js │ │ ├── 57.f1316fb6.js │ │ ├── 69.9e52d998.js │ │ ├── 18.faddd431.js │ │ ├── 72.38ef9238.js │ │ ├── 45.d5a892d0.js │ │ ├── 75.fd9bf91f.js │ │ ├── 70.6909a909.js │ │ ├── 23.7c6d25d9.js │ │ ├── 46.b2597f58.js │ │ ├── 43.8b6224f6.js │ │ ├── 39.84216f96.js │ │ ├── 56.627b1a35.js │ │ ├── 36.529eaf6d.js │ │ └── 42.219bb0ac.js │ └── img │ │ └── search.683d46b0.svg ├── logo.jpg ├── logo.png ├── avatar.jpg ├── avatar.png ├── baidu.png ├── project.jpg ├── img │ └── improve.png ├── algorithm │ ├── 4.14.png │ ├── 4.16.png │ ├── 4.18.png │ ├── 4.7.png │ ├── 4.8.png │ ├── 5.10.png │ ├── 5.16.png │ ├── 5.17.png │ ├── 5.18.png │ ├── 5.7.png │ ├── 6.1.png │ └── 6.13.png ├── FastStoneEditor.jpg ├── icons │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── apple-touch-icon.png │ ├── mstile-150x150.png │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ └── msapplication-icon-144x144.png ├── line-numbers-mobile.gif ├── line-numbers-desktop.png └── manifest.json ├── test ├── docs-simple │ └── README.md ├── prepare │ ├── fixtures │ │ ├── docs-simple │ │ │ └── README.md │ │ ├── docs-custom-theme │ │ │ ├── .vuepress │ │ │ │ ├── theme │ │ │ │ │ └── Layout.vue │ │ │ │ └── config.js │ │ │ └── README.md │ │ └── docs-simple-config │ │ │ ├── README.md │ │ │ └── .vuepress │ │ │ └── config.js │ └── util.spec.js ├── markdown │ ├── fragments │ │ ├── code.md │ │ ├── container-tip.md │ │ ├── container-v-pre.md │ │ ├── code-snippet.md │ │ ├── container-danger.md │ │ ├── container-tip-override.md │ │ ├── container-warning.md │ │ ├── snippet.js │ │ ├── code-highlightLines-single.md │ │ ├── code-snippet-highlightLines-multiple.md │ │ ├── code-snippet-highlightLines-single.md │ │ ├── code-highlightLines-multiple.md │ │ └── hoist.md │ ├── __snapshots__ │ │ ├── highlight.spec.js.snap │ │ ├── highlightLines.spec.js.snap │ │ ├── hoist.spec.js.snap │ │ ├── link.spec.js.snap │ │ ├── lineNumers.spec.js.snap │ │ ├── snippet.spec.js.snap │ │ └── containers.spec.js.snap │ ├── highlight.spec.js │ ├── containers.spec.js │ ├── util.js │ ├── hoist.spec.js │ ├── slugify.spec.js │ ├── highlightLines.spec.js │ ├── lineNumers.spec.js │ ├── snippet.spec.js │ └── link.spec.js ├── hoc.js ├── jest.config.js ├── prepare.js ├── default-theme │ ├── __snapshots__ │ │ ├── NavLink.spec.js.snap │ │ └── DropdownLink.spec.js.snap │ ├── DropdownLink.spec.js │ └── NavLink.spec.js ├── app │ └── Content.spec.js └── util.js ├── src ├── zh │ ├── react │ │ ├── React组件.md │ │ ├── JSX.md │ │ ├── 组件通信.md │ │ ├── Props.md │ │ ├── MVVM.md │ │ ├── redux中间件.md │ │ ├── 高阶组件.md │ │ ├── React生命周期.md │ │ └── redux.md │ ├── vue │ │ ├── Babel.md │ │ ├── Vue 各种方法之间的区别.md │ │ ├── Vue动画.md │ │ ├── Promise.md │ │ ├── vue钩子函数.md │ │ ├── Vue路由.md │ │ ├── Vue组件.md │ │ └── vuex.md │ ├── interface │ │ ├── Mind.md │ │ └── TouTiao.md │ ├── algorithm │ │ ├── browser.md │ │ ├── Charpter6.md │ │ └── Charpter4.md │ ├── miniapp │ │ ├── wepy组件通信.md │ │ ├── 小程序组件.md │ │ ├── 小程序组件化.md │ │ ├── WXS.md │ │ ├── 小程序事件.md │ │ └── 小程序路由.md │ ├── README.md │ ├── interview │ │ ├── index.md │ │ └── longhu.md │ ├── guide │ │ ├── getting-started.md │ │ ├── basic-config.md │ │ ├── assets.md │ │ ├── README.md │ │ └── i18n.md │ └── standard │ │ ├── Start.md │ │ ├── Cooperation.md │ │ └── Project.md ├── .vuepress │ ├── public │ │ ├── avatar.jpg │ │ ├── avatar.png │ │ ├── baidu.png │ │ ├── logo.jpg │ │ ├── logo.png │ │ ├── project.jpg │ │ ├── img │ │ │ └── improve.png │ │ ├── algorithm │ │ │ ├── 4.7.png │ │ │ ├── 4.8.png │ │ │ ├── 5.7.png │ │ │ ├── 6.1.png │ │ │ ├── 4.14.png │ │ │ ├── 4.16.png │ │ │ ├── 4.18.png │ │ │ ├── 5.10.png │ │ │ ├── 5.16.png │ │ │ ├── 5.17.png │ │ │ ├── 5.18.png │ │ │ └── 6.13.png │ │ ├── FastStoneEditor.jpg │ │ ├── icons │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── mstile-150x150.png │ │ │ ├── apple-touch-icon.png │ │ │ ├── android-chrome-192x192.png │ │ │ ├── android-chrome-512x512.png │ │ │ ├── apple-touch-icon-60x60.png │ │ │ ├── apple-touch-icon-76x76.png │ │ │ ├── apple-touch-icon-120x120.png │ │ │ ├── apple-touch-icon-152x152.png │ │ │ ├── apple-touch-icon-180x180.png │ │ │ └── msapplication-icon-144x144.png │ │ ├── line-numbers-desktop.png │ │ ├── line-numbers-mobile.gif │ │ └── manifest.json │ └── components │ │ └── Bit.vue ├── README.md └── guide │ ├── getting-started.md │ ├── assets.md │ ├── basic-config.md │ └── README.md ├── scripts ├── deploy-gh.sh └── release.sh ├── .babelrc ├── .npmignore ├── .eslintrc.js ├── README.md ├── .gitignore └── README-cn.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/app/.temp/override.styl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/app/.temp/style.styl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/assets/css/7.styles.c8b06cc2.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/noop.js: -------------------------------------------------------------------------------- 1 | module.exports = {} 2 | -------------------------------------------------------------------------------- /lib/webpack/noopModule.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /test/docs-simple/README.md: -------------------------------------------------------------------------------- 1 | # Hello Simple 2 | -------------------------------------------------------------------------------- /lib/app/.temp/enhanceApp.js: -------------------------------------------------------------------------------- 1 | export default function () {} -------------------------------------------------------------------------------- /lib/app/.temp/themeEnhanceApp.js: -------------------------------------------------------------------------------- 1 | export default function () {} -------------------------------------------------------------------------------- /test/prepare/fixtures/docs-simple/README.md: -------------------------------------------------------------------------------- 1 | # Simple Docs 2 | -------------------------------------------------------------------------------- /test/markdown/fragments/code.md: -------------------------------------------------------------------------------- 1 | ``` js 2 | new Vue() 3 | ``` 4 | -------------------------------------------------------------------------------- /test/prepare/fixtures/docs-custom-theme/.vuepress/theme/Layout.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/prepare/fixtures/docs-custom-theme/README.md: -------------------------------------------------------------------------------- 1 | # Simple Docs 2 | -------------------------------------------------------------------------------- /test/prepare/fixtures/docs-simple-config/README.md: -------------------------------------------------------------------------------- 1 | # Simple Docs 2 | -------------------------------------------------------------------------------- /docs/assets/css/4.styles.4c7ddd69.css: -------------------------------------------------------------------------------- 1 | .example_23i3u5eI{color:#41b883} -------------------------------------------------------------------------------- /docs/assets/css/6.styles.7081061c.css: -------------------------------------------------------------------------------- 1 | .example_2R8aKaq3{color:#41b883} -------------------------------------------------------------------------------- /docs/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/logo.jpg -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/logo.png -------------------------------------------------------------------------------- /docs/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/avatar.jpg -------------------------------------------------------------------------------- /docs/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/avatar.png -------------------------------------------------------------------------------- /docs/baidu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/baidu.png -------------------------------------------------------------------------------- /docs/project.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/project.jpg -------------------------------------------------------------------------------- /test/markdown/fragments/container-tip.md: -------------------------------------------------------------------------------- 1 | ::: tip 2 | I am a tip 3 | ::: 4 | -------------------------------------------------------------------------------- /src/zh/react/React组件.md: -------------------------------------------------------------------------------- 1 | # React组件 2 | ##### 无状态组件(视图组件) 3 | ##### class 继承 (容器组件) -------------------------------------------------------------------------------- /test/markdown/fragments/container-v-pre.md: -------------------------------------------------------------------------------- 1 | ::: v-pre 2 | I am a v-pre 3 | ::: 4 | -------------------------------------------------------------------------------- /docs/img/improve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/img/improve.png -------------------------------------------------------------------------------- /test/markdown/fragments/code-snippet.md: -------------------------------------------------------------------------------- 1 | <<< @/test/markdown/fragments/snippet.js 2 | -------------------------------------------------------------------------------- /test/markdown/fragments/container-danger.md: -------------------------------------------------------------------------------- 1 | ::: danger 2 | I am a danger 3 | ::: 4 | -------------------------------------------------------------------------------- /test/markdown/fragments/container-tip-override.md: -------------------------------------------------------------------------------- 1 | ::: tip 提示 2 | I am a tip 3 | ::: 4 | -------------------------------------------------------------------------------- /test/markdown/fragments/container-warning.md: -------------------------------------------------------------------------------- 1 | ::: warning 2 | I am a warning 3 | ::: 4 | -------------------------------------------------------------------------------- /test/markdown/fragments/snippet.js: -------------------------------------------------------------------------------- 1 | export default function () { 2 | // .. 3 | } 4 | -------------------------------------------------------------------------------- /docs/algorithm/4.14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/4.14.png -------------------------------------------------------------------------------- /docs/algorithm/4.16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/4.16.png -------------------------------------------------------------------------------- /docs/algorithm/4.18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/4.18.png -------------------------------------------------------------------------------- /docs/algorithm/4.7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/4.7.png -------------------------------------------------------------------------------- /docs/algorithm/4.8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/4.8.png -------------------------------------------------------------------------------- /docs/algorithm/5.10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/5.10.png -------------------------------------------------------------------------------- /docs/algorithm/5.16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/5.16.png -------------------------------------------------------------------------------- /docs/algorithm/5.17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/5.17.png -------------------------------------------------------------------------------- /docs/algorithm/5.18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/5.18.png -------------------------------------------------------------------------------- /docs/algorithm/5.7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/5.7.png -------------------------------------------------------------------------------- /docs/algorithm/6.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/6.1.png -------------------------------------------------------------------------------- /docs/algorithm/6.13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/algorithm/6.13.png -------------------------------------------------------------------------------- /test/markdown/fragments/code-highlightLines-single.md: -------------------------------------------------------------------------------- 1 | ``` js {1} 2 | new Vue() 3 | ``` 4 | -------------------------------------------------------------------------------- /docs/FastStoneEditor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/FastStoneEditor.jpg -------------------------------------------------------------------------------- /docs/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/favicon-16x16.png -------------------------------------------------------------------------------- /docs/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/favicon-32x32.png -------------------------------------------------------------------------------- /docs/line-numbers-mobile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/line-numbers-mobile.gif -------------------------------------------------------------------------------- /lib/default-theme/styles/toc.styl: -------------------------------------------------------------------------------- 1 | .table-of-contents 2 | .badge 3 | vertical-align middle 4 | -------------------------------------------------------------------------------- /docs/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/mstile-150x150.png -------------------------------------------------------------------------------- /docs/line-numbers-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/line-numbers-desktop.png -------------------------------------------------------------------------------- /src/.vuepress/public/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/avatar.jpg -------------------------------------------------------------------------------- /src/.vuepress/public/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/avatar.png -------------------------------------------------------------------------------- /src/.vuepress/public/baidu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/baidu.png -------------------------------------------------------------------------------- /src/.vuepress/public/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/logo.jpg -------------------------------------------------------------------------------- /src/.vuepress/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/logo.png -------------------------------------------------------------------------------- /docs/assets/js/7.c8b06cc2.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[7],{147:function(n,w,o){}}]); -------------------------------------------------------------------------------- /src/.vuepress/public/project.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/project.jpg -------------------------------------------------------------------------------- /test/markdown/fragments/code-snippet-highlightLines-multiple.md: -------------------------------------------------------------------------------- 1 | <<< @/test/markdown/fragments/snippet.js{1-3} 2 | -------------------------------------------------------------------------------- /test/markdown/fragments/code-snippet-highlightLines-single.md: -------------------------------------------------------------------------------- 1 | <<< @/test/markdown/fragments/snippet.js{1,3} 2 | -------------------------------------------------------------------------------- /src/.vuepress/public/img/improve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/img/improve.png -------------------------------------------------------------------------------- /docs/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /docs/icons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/android-chrome-512x512.png -------------------------------------------------------------------------------- /docs/icons/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/icons/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/4.7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/4.7.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/4.8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/4.8.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/5.7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/5.7.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/6.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/6.1.png -------------------------------------------------------------------------------- /docs/icons/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/icons/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/icons/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/icons/msapplication-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/docs/icons/msapplication-icon-144x144.png -------------------------------------------------------------------------------- /scripts/deploy-gh.sh: -------------------------------------------------------------------------------- 1 | cd / 2 | git add -A 3 | git commit -m 'deploy' 4 | echo "finish commit" 5 | git push -f origin master 6 | -------------------------------------------------------------------------------- /src/.vuepress/public/FastStoneEditor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/FastStoneEditor.jpg -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/4.14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/4.14.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/4.16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/4.16.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/4.18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/4.18.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/5.10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/5.10.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/5.16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/5.16.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/5.17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/5.17.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/5.18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/5.18.png -------------------------------------------------------------------------------- /src/.vuepress/public/algorithm/6.13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/algorithm/6.13.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/favicon-16x16.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/favicon-32x32.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/mstile-150x150.png -------------------------------------------------------------------------------- /src/.vuepress/public/line-numbers-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/line-numbers-desktop.png -------------------------------------------------------------------------------- /src/.vuepress/public/line-numbers-mobile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/line-numbers-mobile.gif -------------------------------------------------------------------------------- /src/.vuepress/public/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/android-chrome-512x512.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /src/.vuepress/public/icons/msapplication-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1z2s/study/HEAD/src/.vuepress/public/icons/msapplication-icon-144x144.png -------------------------------------------------------------------------------- /test/prepare/fixtures/docs-custom-theme/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | title: 'Hello VuePress', 3 | description: 'Just playing around' 4 | } 5 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | exports.dev = require('./dev') 2 | exports.build = require('./build') 3 | exports.eject = require('./eject') 4 | Object.assign(exports, require('./util')) 5 | -------------------------------------------------------------------------------- /test/markdown/fragments/code-highlightLines-multiple.md: -------------------------------------------------------------------------------- 1 | ``` js {1-2,4-5} 2 | const app = new Vue({ 3 | render, 4 | router 5 | }) 6 | 7 | app.$mount('#app') 8 | ``` 9 | -------------------------------------------------------------------------------- /test/markdown/fragments/hoist.md: -------------------------------------------------------------------------------- 1 | # H1 2 | 3 | 4 | 9 | 10 | ## H2 11 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "test": { 4 | "presets": [ 5 | ["@babel/preset-env", { "targets": { "node": 8 }}] 6 | ] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/app/store.js: -------------------------------------------------------------------------------- 1 | // It is not yet time to use Vuex to manage the global state 2 | // singleton object as a global store. 3 | const state = { 4 | disableScrollBehavior: false 5 | } 6 | 7 | export default state 8 | -------------------------------------------------------------------------------- /lib/app/root-mixins/index.js: -------------------------------------------------------------------------------- 1 | import updateMeta from './updateMeta' 2 | import activeHeaderLinks from '@activeHeaderLinks' 3 | 4 | export default [ 5 | updateMeta, // required 6 | activeHeaderLinks // optional 7 | ] 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Basic 2 | *.log 3 | .temp 4 | vuepress 5 | art 6 | docs 7 | .eslintrc.js 8 | yarn.lock 9 | TODOs.md 10 | .github 11 | .idea 12 | 13 | # CI related 14 | scripts 15 | 16 | # Test related 17 | test 18 | .babelrc 19 | -------------------------------------------------------------------------------- /lib/default-theme/search.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: [ 4 | 'plugin:vue-libs/recommended', 5 | 'plugin:jest/recommended' 6 | ], 7 | rules: { 8 | indent: ['error', 2, { MemberExpression: 'off' }] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/zh/react/JSX.md: -------------------------------------------------------------------------------- 1 | # JSX 2 | #### 1、jsx是什么? 3 | - React 使用 JSX 来替代常规的 JavaScript 4 | - JSX 是一个看起来很像 XML 的 JavaScript 语法扩展 5 | - 我们不需要一定使用 JSX,但它有以下优点 6 | 1. > JSX 执行更快,因为它在编译为 JavaScript 代码后进行了优化 7 | 1. > 它是类型安全的,在编译过程中就能发现错误 8 | 1. > 使用 JSX 编写模板更加简单快速 -------------------------------------------------------------------------------- /docs/assets/img/search.683d46b0.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/default-theme/styles/wrapper.styl: -------------------------------------------------------------------------------- 1 | $wrapper 2 | max-width $contentWidth 3 | margin 0 auto 4 | padding 2rem 2.5rem 5 | @media (max-width: $MQNarrow) 6 | padding 2rem 7 | @media (max-width: $MQMobileNarrow) 8 | padding 1.5rem 9 | 10 | -------------------------------------------------------------------------------- /docs/assets/css/3.styles.e7495a9d.css: -------------------------------------------------------------------------------- 1 | @media screen and (min-width:719px){.line-numbers-mobile-snap{display:none}}@media screen and (max-width:719px){.line-numbers-desktop-snap{display:none}.line-numbers-mobile-snap{max-width:none!important;margin:0 -1.5rem;width:100vw}} -------------------------------------------------------------------------------- /docs/assets/css/5.styles.d250c3e3.css: -------------------------------------------------------------------------------- 1 | @media screen and (min-width:719px){.line-numbers-mobile-snap{display:none}}@media screen and (max-width:719px){.line-numbers-desktop-snap{display:none}.line-numbers-mobile-snap{max-width:none!important;margin:0 -1.5rem;width:100vw}} -------------------------------------------------------------------------------- /lib/util/shared.js: -------------------------------------------------------------------------------- 1 | exports.compose = (...processors) => { 2 | if (processors.length === 0) return input => input 3 | if (processors.length === 1) return processors[0] 4 | return processors.reduce((prev, next) => { 5 | return (...args) => next(prev(...args)) 6 | }) 7 | } 8 | -------------------------------------------------------------------------------- /test/prepare/fixtures/docs-simple-config/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | title: 'Hello VuePress', 3 | description: 'Just playing around', 4 | dest: 'vuepress', 5 | base: 'vuepress', 6 | head: [ 7 | ['link', { rel: 'icon', href: '/logo.png' }] 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /docs/assets/css/2.styles.58c85033.css: -------------------------------------------------------------------------------- 1 | .bit-sponsor{font-weight:600;background-color:#f3f6f8;padding:.6em 1.2em;border-radius:8px;display:inline-block;margin:1em 0!important}.bit-sponsor a{color:#999}.bit-sponsor img{height:40px;margin-left:15px}.bit-sponsor img,.bit-sponsor span{vertical-align:middle} -------------------------------------------------------------------------------- /lib/app/index.dev.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |new Vue()
5 |
6 | `;
7 |
--------------------------------------------------------------------------------
/src/zh/vue/Babel.md:
--------------------------------------------------------------------------------
1 | # Babel
2 | #### 1、Babel
3 | - 是javascript的编译器/解码器/转码器/解析器
4 |
5 | #### 2、配置
6 | - .babelrc
7 |
8 | ```
9 | 命令:
10 | babel ./index.js -o ./_index.js
11 | 下包:
12 | cnpm install --save-dev babel-cli babel-preset-env
13 |
14 |
15 | {
16 | "presets": [
17 | "env"
18 | ]
19 | }
20 |
21 | babel-loader // es6转es5
22 | ```
23 |
--------------------------------------------------------------------------------
/lib/app/components/Content.js:
--------------------------------------------------------------------------------
1 | export default {
2 | functional: true,
3 |
4 | props: {
5 | custom: {
6 | type: Boolean,
7 | default: true
8 | }
9 | },
10 |
11 | render (h, { parent, props, data }) {
12 | return h(parent.$page.key, {
13 | class: [props.custom ? 'custom' : '', data.class, data.staticClass],
14 | style: data.style
15 | })
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/zh/react/Props.md:
--------------------------------------------------------------------------------
1 | # Props
2 | #### 1、和props相关
3 | - 只读,不准修改
4 | - componentWillReceiveProps / 生命周期
5 | - propTypes
6 | - defaultProps
7 | - children
8 | #### 2、类型检查
9 |
10 | ```
11 | import PropTypes from 'prop-types';
12 |
13 | List.propTypes = {
14 | list:PropTypes.array/object/number/string
15 | }
16 | ```
17 | #### 3、默认值
18 | ```
19 | List.defaultProps = {
20 | list:[{},{},{}]
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/lib/app/serverEntry.js:
--------------------------------------------------------------------------------
1 | import { createApp } from './app'
2 |
3 | export default context => new Promise((resolve, reject) => {
4 | const { app, router } = createApp()
5 | const { url } = context
6 | const { fullPath } = router.resolve(url).route
7 |
8 | if (fullPath !== url) {
9 | return reject({ url: fullPath })
10 | }
11 |
12 | router.push(url)
13 | router.onReady(() => resolve(app))
14 | })
15 |
--------------------------------------------------------------------------------
/lib/service-worker/skip-waiting.js:
--------------------------------------------------------------------------------
1 | addEventListener('message', event => {
2 | const replyPort = event.ports[0]
3 | const message = event.data
4 | if (replyPort && message && message.type === 'skip-waiting') {
5 | event.waitUntil(
6 | self.skipWaiting().then(
7 | () => replyPort.postMessage({ error: null }),
8 | error => replyPort.postMessage({ error })
9 | )
10 | )
11 | }
12 | })
13 |
--------------------------------------------------------------------------------
/lib/markdown/hoist.js:
--------------------------------------------------------------------------------
1 | module.exports = md => {
2 | const RE = /^<(script|style)(?=(\s|>|$))/i
3 |
4 | md.renderer.rules.html_block = (tokens, idx) => {
5 | const content = tokens[idx].content
6 | const hoistedTags = md.__data.hoistedTags || (md.__data.hoistedTags = [])
7 | if (RE.test(content.trim())) {
8 | hoistedTags.push(content)
9 | return ''
10 | } else {
11 | return content
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/lib/app/util.js:
--------------------------------------------------------------------------------
1 | export function injectMixins (options, mixins) {
2 | if (!options.mixins) {
3 | options.mixins = []
4 | }
5 | options.mixins.push(...mixins)
6 | }
7 |
8 | export function findPageForPath (pages, path) {
9 | for (let i = 0; i < pages.length; i++) {
10 | const page = pages[i]
11 | if (page.path === path) {
12 | return page
13 | }
14 | }
15 | return {
16 | path: '',
17 | frontmatter: {}
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/docs/assets/js/1.445f32b6.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[1],{135:function(t,n,e){},141:function(t,n,e){"use strict";var a=e(135);e.n(a).a},184:function(t,n,e){"use strict";e.r(n);var a={functional:!0,props:{type:{type:String,default:"tip"},text:String,vertical:{type:String,default:"top"}},render:function(t,n){var e=n.props,a=n.slots;return t("span",{class:["badge",e.type,e.vertical]},e.text||a().default)}},r=(e(141),e(0)),i=Object(r.a)(a,void 0,void 0,!1,null,"97b6395a",null);n.default=i.exports}}]);
--------------------------------------------------------------------------------
/docs/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "VuePress",
3 | "short_name": "VuePress",
4 | "icons": [
5 | {
6 | "src": "/icons/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/icons/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "start_url": "/index.html",
17 | "display": "standalone",
18 | "background_color": "#fff",
19 | "theme_color": "#3eaf7c"
20 | }
21 |
--------------------------------------------------------------------------------
/test/hoc.js:
--------------------------------------------------------------------------------
1 | const Component = {
2 | props: ['name'],
3 | render (h) {
4 | return h('p', {
5 | class: ['component', this.name]
6 | }, this.name)
7 | }
8 | }
9 |
10 | // When the child component is a pure presentation component,
11 | // we want to be able to display a sub-component with minimal info,
12 | // rather than stubbing it directly.
13 | export function mockComponent (name) {
14 | return {
15 | render (h) {
16 | return h(Component, { props: { name }})
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/test/markdown/highlight.spec.js:
--------------------------------------------------------------------------------
1 | import { Md, getFragment } from './util'
2 | import highlight from '@/markdown/highlight.js'
3 |
4 | const md = Md()
5 | const mdH = Md().set({ highlight })
6 |
7 | describe('highlight', () => {
8 | test('should highlight code', async () => {
9 | const input = await getFragment('code')
10 | const output1 = md.render(input)
11 | const output2 = mdH.render(input)
12 | expect(output1 === output2).toBe(false)
13 | expect(output2).toMatchSnapshot()
14 | })
15 | })
16 |
--------------------------------------------------------------------------------
/src/.vuepress/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "VuePress",
3 | "short_name": "VuePress",
4 | "icons": [
5 | {
6 | "src": "/icons/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/icons/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "start_url": "/index.html",
17 | "display": "standalone",
18 | "background_color": "#fff",
19 | "theme_color": "#3eaf7c"
20 | }
21 |
--------------------------------------------------------------------------------
/docs/assets/css/1.styles.445f32b6.css:
--------------------------------------------------------------------------------
1 | .badge[data-v-97b6395a]{display:inline-block;font-size:14px;height:18px;line-height:18px;border-radius:3px;padding:0 6px;color:#fff;margin-right:5px;background-color:#42b983}.badge.middle[data-v-97b6395a]{vertical-align:middle}.badge.top[data-v-97b6395a]{vertical-align:top}.badge.green[data-v-97b6395a],.badge.tip[data-v-97b6395a]{background-color:#42b983}.badge.error[data-v-97b6395a]{background-color:#da5961}.badge.warn[data-v-97b6395a],.badge.warning[data-v-97b6395a],.badge.yellow[data-v-97b6395a]{background-color:#e7c000}
--------------------------------------------------------------------------------
/test/markdown/containers.spec.js:
--------------------------------------------------------------------------------
1 | import { Md, getFragment } from './util'
2 | import containers from '@/markdown/containers.js'
3 |
4 | const mdC = Md().use(containers)
5 |
6 | describe('containers', () => {
7 | const containerLabels = ['tip', 'tip-override', 'warning', 'danger', 'v-pre']
8 | containerLabels.forEach(label => {
9 | test(label, async () => {
10 | const input = await getFragment(`container-${label}`)
11 | const output = mdC.render(input)
12 | expect(output).toMatchSnapshot()
13 | })
14 | })
15 | })
16 |
--------------------------------------------------------------------------------
/test/markdown/util.js:
--------------------------------------------------------------------------------
1 | import fs from 'fs-extra'
2 | import LRU from 'lru-cache'
3 | import path from 'path'
4 |
5 | const cache = LRU({ max: 1000 })
6 |
7 | export function Md () {
8 | return require('markdown-it')()
9 | }
10 |
11 | export async function getFragment (name) {
12 | let content = cache.get(name)
13 | if (content) {
14 | return content
15 | }
16 | const target = path.resolve(__dirname, `fragments/${name}.md`)
17 | content = await fs.readFile(target, 'utf-8')
18 | cache.set(name, content)
19 | return content
20 | }
21 |
--------------------------------------------------------------------------------
/src/zh/interface/Mind.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 思维导图版知识点总结
3 | sidebar: auto
4 | sidebarDepth: 2
5 | ---
6 | # 思维导图版知识点总结
7 |
8 | ## Vue
9 | 
10 |
11 | ## React
12 | 
13 |
14 | ## 阶段一
15 | 
16 |
17 | ## 阶段二
18 | 
19 |
--------------------------------------------------------------------------------
/lib/default-theme/styles/config.styl:
--------------------------------------------------------------------------------
1 | // colors
2 | $accentColor = #3eaf7c
3 | $textColor = #2c3e50
4 | $borderColor = #eaecef
5 | $codeBgColor = #282c34
6 | $arrowBgColor = #ccc
7 |
8 | // layout
9 | $navbarHeight = 3.6rem
10 | $sidebarWidth = 20rem
11 | $contentWidth = 740px
12 |
13 | // responsive breakpoints
14 | $MQNarrow = 959px
15 | $MQMobile = 719px
16 | $MQMobileNarrow = 419px
17 |
18 | // code
19 | $lineNumbersWrapperWidth = 3.5rem
20 | $codeLang = js ts html md vue css sass scss less stylus go java c sh yaml py
21 |
22 | @import '~@temp/override.styl'
23 |
--------------------------------------------------------------------------------
/src/zh/vue/Vue 各种方法之间的区别.md:
--------------------------------------------------------------------------------
1 | # Vue一些对比
2 | #### 一、methods和computed
3 | - computed是计算属性,methods是方法。
4 | - computed计算属性是基于它们的依赖进行==缓存==的
5 | - computed只有在它的相关依赖发生改变时才会重新求值
6 | - 而对于method ,只要发生重新渲染,method 调用==总会==执行该函数
7 | - ==总之:数据量大,需要缓存的时候用computed;每次确实需要重新加载,不需要缓存时用methods==
8 | #### 二、computed和watch
9 | - 计算属性是==计算属性==,==侦听器watch==是侦听器watch
10 | - 侦听器watch是侦听一个特定的值,当该值变化时执行特定的函数
11 | #### 三、$router和$route
12 | - router为VueRouter的实例,相当于一个全局的路由器对象,里面含有很多属性和子对象
13 | - route相当于当前正在跳转的路由对象。。可以从里面获取name,path,params,query等
14 | - 打印this.$route和this.$router,==两个同时存在==。
15 | - 两者传参方式相同
--------------------------------------------------------------------------------
/src/zh/vue/Vue动画.md:
--------------------------------------------------------------------------------
1 | # Vue动画
2 | #### 1、transition
3 | 1. name="" -> 手写
4 | 2. animate.css
5 | 3. velocity.js
6 | #### 2、进入动画 从0-1
7 | 1. v-enter // 进入前
8 | 2. v-enter-active // 定义进入过渡生效时的状态
9 | 3. v-enter-to // 定义进入过渡结束时的状态
10 | #### 3、离开动画 从1-0
11 | 1. v-leave // 离开前
12 | 2. v-leave-active // 离开中
13 | 3. v-leave-to // 离开后
14 | #### 4、过渡持续时间
15 | - :duration='1000'
16 | - :duration='{enter:'1000',leave:'1000'}'
17 | #### 5、JavaScript钩子
18 |
19 | ```
20 | v-on:before-enter
21 | v-on:enter
22 | v-on:after-enter
23 | v-on:enter-cancelled // 取消动画(删除)
24 | ```
25 |
26 |
--------------------------------------------------------------------------------
/src/zh/react/MVVM.md:
--------------------------------------------------------------------------------
1 | # MVVM
2 | #### 1、MVVM是什么?
3 | 1. MVVM是Model-View-ViewModel的简写
4 | 2. 它本质上是MVC 的改进版
5 | 3. MVVM(Model-View-ViewModel)框架的由来是MVP(Model-View-Presenter)模式与WPF结合的应用方式时发展演变过来的一种新型架构框架
6 | #### 2、MVVM优点
7 |
8 | - > MVVM模式和MVC模式一样,主要目的是分离视图(View)和模型(Model),有几大优点
9 |
10 | 1. **低耦合**:视图(View)可以独立于Model变化和修改,一个ViewModel可以绑定到不同的"View"上,当View变化的时候Model可以不变,当Model变化的时候View也可以不变
11 | 2. **可重用性**:你可以把一些视图逻辑放在一个ViewModel里面,让很多view重用这段视图逻辑
12 | 3. **独立开发**:开发人员可以专注于业务逻辑和数据的开发(ViewModel),设计人员可以专注于页面设计,使用Expression Blend可以很容易设计界面并生成xml代码
13 | 4. **可测试**:界面素来是比较难于测试的,而现在测试可以针对ViewModel来写
--------------------------------------------------------------------------------
/lib/default-theme/NotFound.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ getMsg() }}6 |
5 | vue
6 |
13 | vue
14 |
21 | some link with code
22 |
.... 2 | // 3 | // If your plugin was chained before preWrapper, you can add additional eleemnt directly. 4 | // If your plugin was chained after preWrapper, you can use these slots: 5 | // 1. 6 | // 2. 7 | // 3. 8 | // 4. 9 | 10 | module.exports = md => { 11 | const fence = md.renderer.rules.fence 12 | md.renderer.rules.fence = (...args) => { 13 | const [tokens, idx] = args 14 | const token = tokens[idx] 15 | const rawCode = fence(...args) 16 | return `
3 |
4 | This project is sponsored by
5 |
6 |
7 |
new Vue()
21 |
22 |
23 |
24 | export default function () {
5 | // ..
6 | }
7 |
8 | `;
9 |
10 | exports[`snippet import snippet with highlight multiple lines 1`] = `
11 | outbound-link
7 | 8 | `; 9 | 10 | exports[`NavLink $i18n - renders nav link with internal link 1`] = `VuePress`; 11 | 12 | exports[`NavLink $simple - renders nav link with external link 1`] = ` 13 | 14 | Vue 15 |outbound-link
16 | 17 | `; 18 | 19 | exports[`NavLink $simple - renders nav link with internal link 1`] = `VuePress`; 20 | -------------------------------------------------------------------------------- /lib/markdown/slugify.js: -------------------------------------------------------------------------------- 1 | // string.js slugify drops non ascii chars so we have to 2 | // use a custom implementation here 3 | const removeDiacritics = require('diacritics').remove 4 | // eslint-disable-next-line no-control-regex 5 | const rControl = /[\u0000-\u001f]/g 6 | const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'<>,.?/]+/g 7 | 8 | module.exports = function slugify (str) { 9 | return removeDiacritics(str) 10 | // Remove control characters 11 | .replace(rControl, '') 12 | // Replace special characters 13 | .replace(rSpecial, '-') 14 | // Remove continous separators 15 | .replace(/\-{2,}/g, '-') 16 | // Remove prefixing and trailing separtors 17 | .replace(/^\-+|\-+$/g, '') 18 | // ensure it doesn't start with a number (#121) 19 | .replace(/^(\d)/, '_$1') 20 | // lowercase 21 | .toLowerCase() 22 | } 23 | -------------------------------------------------------------------------------- /src/zh/vue/Promise.md: -------------------------------------------------------------------------------- 1 | # Promise/Aysnc 2 | #### 1、es6定义变量 3 | 1. var 4 | 2. let 5 | 3. import 6 | 4. class 7 | 5. function 8 | 6. const 9 | 10 | #### 2、Promise 11 | - 是异步编程的一种解决方案 12 | - 是一个对象 13 | 14 | **缺点** 15 | 1. 无法取消 16 | 17 | ``` 18 | Promise.all() 会包装多个实例成为一个新的promise实例 19 | 20 | new Promise((resolve.reject) =>{ 21 | // do some async function 22 | if(true){ 23 | // resolve 代表成功的回调 24 | resolve(data); 25 | }else{ 26 | // reject 代表失败的回调 27 | reject(data); 28 | } 29 | }) 30 | ``` 31 | #### 3、异步加载图片 32 | 1. 数据请求 -> 接口(Interface) 33 | 2. 创建图片 34 | 3. 插入到页面当中 35 | #### 4、继承 36 | obj1 extends obj2 37 | 38 | 如果继承就一定要在contructor第一行加super()方法 39 | #### 5、异步加载 40 | 1. ajax 41 | 2. 加载图片 42 | 3. jsonp 43 | 44 | #### 6、语法糖 45 | 再不改变代码的情况下让代码更简洁 46 | #### 7、async 47 | 1. 内置执行器 48 | 2. 更好的语义 49 | 3. 更广的适用性 50 | 4. 返回Promise -------------------------------------------------------------------------------- /test/default-theme/DropdownLink.spec.js: -------------------------------------------------------------------------------- 1 | import { mount, RouterLinkStub } from '@vue/test-utils' 2 | import DropdownLink from '@/default-theme/DropdownLink.vue' 3 | import { modeTestRunner } from '../util' 4 | 5 | function test (mode, localVue) { 6 | it(`$${mode} - renders dropdown link.`, () => { 7 | const item = { 8 | text: 'VuePress', 9 | items: [ 10 | { 11 | text: 'Guide', 12 | link: '/guide/' 13 | }, 14 | { 15 | text: 'Config Reference', 16 | link: '/config/' 17 | } 18 | ] 19 | } 20 | const wrapper = mount(DropdownLink, { 21 | localVue, 22 | stubs: { 23 | 'router-link': RouterLinkStub 24 | }, 25 | propsData: { item } 26 | }) 27 | expect(wrapper.html()).toMatchSnapshot() 28 | }) 29 | } 30 | 31 | modeTestRunner('DropdownLink', test) 32 | -------------------------------------------------------------------------------- /lib/app/index.ssr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |WARNING
6 |I am a danger
7 |TIP
13 |I am a tip
14 |提示
20 |I am a tip
21 |I am a v-pre
27 |WARNING
33 |I am a warning
34 |'),
10 | rawCode.indexOf('')
11 | )
12 |
13 | const lines = code.split('\n')
14 | const lineNumbersCode = [...Array(lines.length - 1)]
15 | .map((line, index) => `${index + 1}${info || defaultTitle}
\n` 23 | } else { 24 | return `
2 |
3 |
${code}`
15 | }
16 |
17 | module.exports = (str, lang) => {
18 | if (!lang) {
19 | return wrap(str, 'text')
20 | }
21 | lang = lang.toLowerCase()
22 | const rawLang = lang
23 | if (lang === 'vue' || lang === 'html') {
24 | lang = 'markup'
25 | }
26 | if (lang === 'md') {
27 | lang = 'markdown'
28 | }
29 | if (lang === 'ts') {
30 | lang = 'typescript'
31 | }
32 | if (lang === 'py') {
33 | lang = 'python'
34 | }
35 | if (!prism.languages[lang]) {
36 | try {
37 | loadLanguages([lang])
38 | } catch (e) {
39 | logger.warn(chalk.yellow(`[vuepress] Syntax highlight for language "${lang}" is not supported.`))
40 | }
41 | }
42 | if (prism.languages[lang]) {
43 | const code = prism.highlight(str, prism.languages[lang], lang)
44 | return wrap(code, rawLang)
45 | }
46 | return wrap(str, 'text')
47 | }
48 |
--------------------------------------------------------------------------------
/src/guide/getting-started.md:
--------------------------------------------------------------------------------
1 | # 起步
2 |
3 | ::: warning 兼容性注意事项
4 | VuePress 要求 Node.js >= 8。
5 | :::
6 |
7 | ## 全局安装
8 |
9 | 如果你只是想随便用下 VuePress,你可以在全局安装它:
10 |
11 | ``` bash
12 | # 全局安装
13 | yarn global add vuepress # 或 npm install -g vuepress
14 |
15 | # 创建一个 markdown 文件
16 | echo '# Hello VuePress' > README.md
17 |
18 | # 开始编写文档
19 | vuepress dev
20 |
21 | # 构建
22 | vuepress build
23 | ```
24 |
25 | ## 在已有项目中安装
26 |
27 | 如果你想要在一个已有项目中维护文档,就应该将 VuePress 安装为本地依赖。此设置还允许你使用 CI 或 Netlify 服务,在推送时自动部署。
28 |
29 | ``` bash
30 | # 安装为本地依赖项
31 | yarn add -D vuepress # 或 npm install -D vuepress
32 |
33 | # 创建一个 docs 目录
34 | mkdir docs
35 | # 创建一个 markdown 文件
36 | echo '# Hello VuePress' > docs/README.md
37 | ```
38 |
39 | ::: warning 警告
40 | 当将 VuePress 安装到以 webpack 3.x 作为依赖项的已有项目中时,推荐使用[Yarn](https://yarnpkg.com/en/) 而不是 npm。因为在这种情况下,Npm 无法生成正确的依赖关系树。
41 | :::
42 |
43 | 然后,给 `package.json` 添加一些 scripts 脚本:
44 |
45 | ``` json
46 | {
47 | "scripts": {
48 | "docs:dev": "vuepress dev docs",
49 | "docs:build": "vuepress build docs"
50 | }
51 | }
52 | ```
53 |
54 | 你现在就可以开始编写文档了:
55 |
56 | ``` bash
57 | yarn docs:dev # 或 npm run docs:dev
58 | ```
59 |
60 | 要生成静态资源,请运行:
61 |
62 | ``` bash
63 | yarn docs:build # 或 npm run docs:build
64 | ```
65 |
66 | 默认情况下,构建的文件会位于 `.vuepress/dist` 中,该文件可以通过 `.vuepress/config.js` 中的 `dest` 字段进行配置。构建的文件可以部署到任何静态文件服务器。关于如何部署到一些常用服务,请参考 [部署指南](./deploy.md)。
67 |
--------------------------------------------------------------------------------
/scripts/release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "Select a option to release (input a serial number):"
4 | echo
5 |
6 | select VERSION in patch minor major "Specific Version"
7 | do
8 | echo
9 | if [[ $REPLY =~ ^[1-4]$ ]]; then
10 | if [[ $REPLY == 4 ]]; then
11 | read -p "Enter a specific version: " -r VERSION
12 | echo
13 | if [[ -z $REPLY ]]; then
14 | VERSION=$REPLY
15 | fi
16 | fi
17 |
18 | read -p "Release $VERSION - are you sure? (y/n) " -n 1 -r
19 | echo
20 |
21 | if [[ $REPLY =~ ^[Yy]$ || -z $REPLY ]]; then
22 | # pre release task
23 | npm run lint
24 | npm run test
25 |
26 | # bump version
27 | npm version $VERSION
28 | NEW_VERSION=$(node -p "require('./package.json').version")
29 | echo Releasing ${NEW_VERSION} ...
30 |
31 | # npm release
32 | npm whoami
33 | npm publish
34 | echo "✅ Released to npm."
35 |
36 | # github release
37 | git add CHANGELOG.md
38 | git commit -m "chore: changelog"
39 | git push
40 | git push origin refs/tags/v${NEW_VERSION}
41 | echo "✅ Released to Github."
42 | else
43 | echo Cancelled
44 | fi
45 | break
46 | else
47 | echo Invalid \"${REPLY}\"
48 | echo "To continue, please input a serial number(1-4) of an option."
49 | echo
50 | fi
51 | done
52 |
53 |
--------------------------------------------------------------------------------
/src/zh/guide/getting-started.md:
--------------------------------------------------------------------------------
1 | # 快速上手
2 |
3 | ::: warning 注意
4 | 请确保你的 Node.js 版本 >= 8。
5 | :::
6 |
7 | ## 全局安装
8 |
9 | 如果你只是想尝试一下 VuePress,你可以全局安装它:
10 |
11 | ``` bash
12 | # 安装
13 | yarn global add vuepress # 或者:npm install -g vuepress
14 |
15 | # 新建一个 markdown 文件
16 | echo "# Hello VuePress!" > README.md
17 |
18 | # 开始写作
19 | vuepress dev .
20 |
21 | # 构建静态文件
22 | vuepress build .
23 | ```
24 |
25 | ## 现有项目
26 |
27 | 如果你想在一个现有项目中使用 VuePress,同时想要在该项目中管理文档,则应该将 VuePress 安装为本地依赖。作为本地依赖安装让你可以使用持续集成工具,或者一些其他服务(比如 Netlify)来帮助你在每次提交代码时自动部署。
28 |
29 | ``` bash
30 | # 将 VuePress 作为一个本地依赖安装
31 | yarn add -D vuepress # 或者:npm install -D vuepress
32 |
33 | # 新建一个 study 文件夹
34 | mkdir study
35 |
36 | # 新建一个 markdown 文件
37 | echo "# Hello VuePress!" > study/README.md
38 |
39 | # 开始写作
40 | npx vuepress dev study
41 | ```
42 |
43 | ::: warning
44 | 如果你的现有项目依赖了 webpack 3.x,推荐使用 [Yarn](https://yarnpkg.com/en/) 而不是 npm 来安装 VuePress。因为在这种情形下,npm 会生成错误的依赖树。
45 | :::
46 |
47 | 接着,在 `package.json` 里加一些脚本:
48 |
49 | ``` json
50 | {
51 | "scripts": {
52 | "study:dev": "vuepress dev study",
53 | "study:build": "vuepress build study"
54 | }
55 | }
56 | ```
57 |
58 | 然后就可以开始写作了:
59 |
60 | ``` bash
61 | yarn study:dev # 或者:npm run study:dev
62 | ```
63 |
64 | 要生成静态的 HTML 文件,运行:
65 |
66 | ``` bash
67 | yarn study:build # 或者:npm run study:build
68 | ```
69 |
70 | 默认情况下,文件将会被生成在 `.vuepress/dist`,当然,你也可以通过 `.vuepress/config.js` 中的 `dest` 字段来修改,生成的文件可以部署到任意的静态文件服务器上,参考 [部署](./deploy.md) 来了解更多。
71 |
--------------------------------------------------------------------------------
/README-cn.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
请下载淘票票
46 | 下载 47 |/
5 |
6 | module.exports = md => {
7 | const fence = md.renderer.rules.fence
8 | md.renderer.rules.fence = (...args) => {
9 | const [tokens, idx, options] = args
10 | const token = tokens[idx]
11 |
12 | const rawInfo = token.info
13 | if (!rawInfo || !RE.test(rawInfo)) {
14 | return fence(...args)
15 | }
16 |
17 | const langName = rawInfo.replace(RE, '').trim()
18 | // ensure the next plugin get the correct lang.
19 | token.info = langName
20 |
21 | const lineNumbers = RE.exec(rawInfo)[1]
22 | .split(',')
23 | .map(v => v.split('-').map(v => parseInt(v, 10)))
24 |
25 | const code = options.highlight
26 | ? options.highlight(token.content, langName)
27 | : token.content
28 |
29 | const rawCode = code.replace(wrapperRE, '')
30 | const highlightLinesCode = rawCode.split('\n').map((split, index) => {
31 | const lineNumber = index + 1
32 | const inRange = lineNumbers.some(([start, end]) => {
33 | if (start && end) {
34 | return lineNumber >= start && lineNumber <= end
35 | }
36 | return lineNumber === start
37 | })
38 | if (inRange) {
39 | return ` `
40 | }
41 | return '
'
42 | }).join('')
43 |
44 | const highlightLinesWrapperCode =
45 | `${highlightLinesCode}`
46 |
47 | return highlightLinesWrapperCode + code
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/zh/standard/Cooperation.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar: auto
3 | sidebarDepth: 2
4 | ---
5 | # 前后端是如何交互的
6 | iOS,H5,安卓等前端开发的如何跟后台进行交互?
7 | 应该怎么去规避一些不该属于自己的任务而被后台强加于自己?
8 |
9 | ## 1.前端请求数据URL由谁来写?
10 | 在开发中,URL主要是由后台来写的,写好了给前端开发者.如果后台在查询数据,需要借助查询条件才能查询到前端需要的数据时,这时后台会要求前端提供相关的查询参数,这里的查询参数也就是URL请求的参数。
11 |
12 | ## 2.接口文档主要由谁来写?
13 | 接口文档也是主要由后台开发者来写的,因为直接跟数据打交道的就是后台,后台是最清楚,数据库里面有什么数据,能返回什么数据.前端开发只是数据的被动接受者.所以接口文档也主要是由后台来完成的,前端只是接口文档的使用者,使用过程中,发现返回的数据不对,则需要跟后台进行商量,由后台来修改.切记 前端不要随意更改接口文档,除非在取得后台开发人员的同意的情况下.总的来讲,接口文档主要由后台来设计,修改,前端开发者起到了辅助的作用.
14 |
15 | ## 3.前端开发与后台交互的数据格式主要是什么?
16 | 主要是JSON
17 | XML现在用的不多
18 |
19 | ## 4.前端开发的后台交互原理?
20 | 在项目的时候,我们前后端会大概说一下接口地址,前端请求的参数,后端返回的参数,然后大家就开始写,写的差不多的时候,大家调一下接口看一下返回的数据,没问题就可以了。
21 |
22 | ## 5.前端请求参数的形式
23 | GET和POST两种方式, 也会采用RESTful架构, 通过请求方式表示用户行为
24 | 对安全性不高 采用get方便
25 | post要比get安全
26 | GET - 从指定的服务器中获取数据
27 | POST - 提交数据给指定的服务器处理
28 |
29 | ## 6.前端应该告知后台哪些有效信息,后台才能返回前端想的数据的呢?
30 | 先将要展示的页面内容进行模块划分,将模块的内容提取出来,以及方便前端的一些标志值等,将所有想要的内容和逻辑告知后端,后端就会去数据库里面去查找相应的数据表中去获得相应的内容,或者图片地址信息。
31 | URL中的参数主要是根据后台需要,
32 | 如果后台需要一个参数作为查询的辅助条件 前端在URL数据请求时就传递参数。参数前面?几个参数中间&
33 |
34 | ## 7.我们应该怎么把页面这些信息有效传达给后台,以及后台是如何获取到这些数据?
35 | 总的来讲:所有前端请求的URL后面的参数,都是辅助后台数据查询的.如果不需要参数,那么后台就会直接给个URL给前端.
36 |
37 | ## 8.前端应该如何回拒一些本不属于自己做的一些功能需求或任务?
38 | 在与后台打交道中,我们经常遇到这种情况,有时候明明后台来处理某个事件很简单,后台非要你来做,这时候我们应该懂得去回绝他.
39 | 原则:前端就是负责把数据展示在页面上
40 | 发挥:这就需要我们对一个需求,一个任务的要有清晰认识了,如果对任务含糊不清,自己都没搞明白,你只能受后台摆布了.最后也会因为任务没有完成而备受责难了.
41 |
42 | ## 9.当前端在调用数据接口时,发现有些数据不是我们想要的,那么前端应该怎么办呢或者怎么跟后台讲呢?
43 | 首先要把请求的URL和返回的数据以及在页面的展示的情况给跟后台看,这样有理有据,后台开发人员是不会说什么的,否则,后台会很不耐烦的,甚至骂你的可能都有,本身做后台比较难,尤其在查询数据,取数据,封装数据方面都比较难处理.
44 |
45 | ## 10.为什么需要在请求的时候传入参数?
46 | 因为后台在查询数据库的时候需要条件查询。
--------------------------------------------------------------------------------
/lib/prepare/loadConfig.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs-extra')
2 | const path = require('path')
3 | const yamlParser = require('js-yaml')
4 | const tomlParser = require('toml')
5 |
6 | module.exports = function loadConfig (vuepressDir, bustCache = true) {
7 | const configPath = path.resolve(vuepressDir, 'config.js')
8 | const configYmlPath = path.resolve(vuepressDir, 'config.yml')
9 | const configTomlPath = path.resolve(vuepressDir, 'config.toml')
10 |
11 | if (bustCache) {
12 | delete require.cache[configPath]
13 | }
14 |
15 | // resolve siteConfig
16 | let siteConfig = {}
17 | if (fs.existsSync(configYmlPath)) {
18 | siteConfig = parseConfig(configYmlPath)
19 | } else if (fs.existsSync(configTomlPath)) {
20 | siteConfig = parseConfig(configTomlPath)
21 | } else if (fs.existsSync(configPath)) {
22 | siteConfig = require(configPath)
23 | }
24 |
25 | return siteConfig
26 | }
27 |
28 | function parseConfig (file) {
29 | const content = fs.readFileSync(file, 'utf-8')
30 | const [extension] = /.\w+$/.exec(file)
31 | let data
32 |
33 | switch (extension) {
34 | case '.yml':
35 | case '.yaml':
36 | data = yamlParser.safeLoad(content)
37 | break
38 |
39 | case '.toml':
40 | data = tomlParser.parse(content)
41 | // reformat to match config since TOML does not allow different data type
42 | // https://github.com/toml-lang/toml#array
43 | const format = []
44 | if (data.head) {
45 | Object.keys(data.head).forEach(meta => {
46 | data.head[meta].forEach(values => {
47 | format.push([meta, values])
48 | })
49 | })
50 | }
51 | data.head = format
52 | break
53 | }
54 |
55 | return data || {}
56 | }
57 |
--------------------------------------------------------------------------------
/lib/webpack/createServerConfig.js:
--------------------------------------------------------------------------------
1 | module.exports = function createServerConfig (options, cliOptions) {
2 | const fs = require('fs')
3 | const path = require('path')
4 | const WebpackBar = require('webpackbar')
5 | const createBaseConfig = require('./createBaseConfig')
6 | const VueSSRServerPlugin = require('vue-server-renderer/server-plugin')
7 | const CopyPlugin = require('copy-webpack-plugin')
8 |
9 | const config = createBaseConfig(options, cliOptions, true /* isServer */)
10 | const { sourceDir, outDir } = options
11 |
12 | config
13 | .target('node')
14 | .externals([/^vue|vue-router$/])
15 | .devtool('source-map')
16 |
17 | // no need to minimize server build
18 | config.optimization.minimize(false)
19 |
20 | config
21 | .entry('app')
22 | .add(path.resolve(__dirname, '../app/serverEntry.js'))
23 |
24 | config.output
25 | .filename('server-bundle.js')
26 | .libraryTarget('commonjs2')
27 |
28 | config
29 | .plugin('ssr-server')
30 | .use(VueSSRServerPlugin, [{
31 | filename: 'manifest/server.json'
32 | }])
33 |
34 | const publicDir = path.resolve(sourceDir, '.vuepress/public')
35 | if (fs.existsSync(publicDir)) {
36 | config
37 | .plugin('copy')
38 | .use(CopyPlugin, [[
39 | { from: publicDir, to: outDir }
40 | ]])
41 | }
42 |
43 | if (!cliOptions.debug) {
44 | config
45 | .plugin('bar')
46 | .use(WebpackBar, [{
47 | name: 'Server',
48 | color: 'blue',
49 | compiledIn: false
50 | }])
51 | }
52 |
53 | if (options.siteConfig.chainWebpack) {
54 | options.siteConfig.chainWebpack(config, true /* isServer */)
55 | }
56 |
57 | return config
58 | }
59 |
--------------------------------------------------------------------------------
/docs/assets/js/57.f1316fb6.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[57],{157:function(t,a,r){"use strict";r.r(a);var e=r(0),_=Object(e.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var t=this,a=t.$createElement,r=t._self._c||a;return r("div",{staticClass:"content"},[r("h1",{attrs:{id:"组件通信"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#组件通信","aria-hidden":"true"}},[t._v("#")]),t._v(" 组件通信")]),t._v(" "),r("h4",{attrs:{id:"需要组件之进行通信的几种情况"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#需要组件之进行通信的几种情况","aria-hidden":"true"}},[t._v("#")]),t._v(" 需要组件之进行通信的几种情况")]),t._v(" "),r("ul",[r("li",[t._v("父组件向子组件通信")]),t._v(" "),r("li",[t._v("子组件向父组件通信")]),t._v(" "),r("li",[t._v("跨级组件通信")]),t._v(" "),r("li",[t._v("没有嵌套关系组件之间的通信")])]),t._v(" "),r("h5",{attrs:{id:"_1、父组件向子组件通信"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#_1、父组件向子组件通信","aria-hidden":"true"}},[t._v("#")]),t._v(" 1、父组件向子组件通信")]),t._v(" "),r("ul",[r("li",[t._v("通过props")])]),t._v(" "),r("h5",{attrs:{id:"_2、子组件向父组件通信"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#_2、子组件向父组件通信","aria-hidden":"true"}},[t._v("#")]),t._v(" 2、子组件向父组件通信")]),t._v(" "),r("ul",[r("li",[t._v("利用回调函数")]),t._v(" "),r("li",[t._v("利用自定义事件机制")])]),t._v(" "),r("h5",{attrs:{id:"_3、-跨级组件通信"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#_3、-跨级组件通信","aria-hidden":"true"}},[t._v("#")]),t._v(" 3、 跨级组件通信")]),t._v(" "),r("ul",[r("li",[t._v("层层组件传递props")]),t._v(" "),r("li",[t._v("使用context")])]),t._v(" "),r("h5",{attrs:{id:"_4、没有嵌套关系组件之间的通信"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#_4、没有嵌套关系组件之间的通信","aria-hidden":"true"}},[t._v("#")]),t._v(" 4、没有嵌套关系组件之间的通信")]),t._v(" "),r("ul",[r("li",[t._v("使用自定义事件机制")])])])}],!1,null,null,null);a.default=_.exports}}]);
--------------------------------------------------------------------------------
/src/guide/basic-config.md:
--------------------------------------------------------------------------------
1 | # 配置
2 |
3 | ## 配置文件(config file)
4 |
5 | 不做任何配置的话,页面会显得过于简单,用户也无法方便地浏览网站。想要定制你的网站,首先需要在文档目录中创建一个 `.vuepress` 目录。这是放置所有 VuePress 特有(VuePress-specific) 文件的地方。你的项目结构可能长这样:
6 |
7 | ```
8 | .
9 | ├─ docs
10 | │ ├─ README.md
11 | │ └─ .vuepress
12 | │ └─ config.js
13 | └─ package.json
14 | ```
15 |
16 | 配置 VuePress 站点的基本文件是 `.vuepress/config.js`,其中导出一个 JavaScript 对象:
17 |
18 | ``` js
19 | module.exports = {
20 | title: 'Hello VuePress',
21 | description: 'Just playing around'
22 | }
23 | ```
24 |
25 | 如果开发服务器正常运行,你应该看到该页面现在有一个 title 标题和一个搜索框。VuePress 带有内置的 基于 header 搜索(headers-based search) 的功能 - 它会自动从所有页面的 title, `h2` 和 `h3` header 标签中,建立一个简单的搜索索引。(译者注:此搜索是遍历 pages 数组的每一项,取出其中的 headers 数组,其中数组每项对应 markdown 标题,具体代码查看 /lib/default-theme/SearchBox.vue 的 suggestions 函数)
26 |
27 | 请查阅 [配置参考](../config/README.md) 以获取完整的选项列表。
28 |
29 | ::: tip 可替代的配置格式
30 | 你也可以使用 YAML(`.vuepress/config.yml`) 或 TOML(`.vuepress/config.toml`) 格式编写配置文件。
31 | :::
32 |
33 | ## 主题配置(theme configuration)
34 |
35 | VuePress 主题,负责网站的所有布局和交互细节。VuePress 附带一个默认主题(你现在看到的就是),专门为技术文档设计。它暴露许多选项,允许你自定义导航栏(navbar)、侧边栏(sidebar)和主页(homepage)等。详细信息请查看 [默认主题配置](../default-theme-config/README.md) 页面。
36 |
37 | 如果你想开发自定义主题,请参考 [自定义主题](./custom-themes.md)。
38 |
39 | ## 应用程序级别的增强功能(app level enhancements)
40 |
41 | 由于 VuePress 应用是一个标准的 Vue 应用程序,所以你可以通过创建一个 `.vuepress/enhanceApp.js` 文件,来使用应用程序级别的增强功能,如果此文件存在,该文件将会被导入到该应用程序中。该文件应该通过 `export default` 方式导出一个钩子函数,它将接收一个含有一些应用程序级别值的对象作为参数。你可以使用这个钩子来安装额外的 Vue 插件,注册全局组件,或者添加额外的路由钩子:
42 |
43 | ``` js
44 | export default ({
45 | Vue, // 当前 VuePress 应用所使用的 Vue 版本
46 | options, // 根 Vue 实例的选项
47 | router, // 应用程序的路由实例
48 | siteData // 网站元数据
49 | }) => {
50 | // ...使用应用程序级别的增强功能
51 | }
52 | ```
53 |
--------------------------------------------------------------------------------
/docs/assets/js/69.9e52d998.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[69],{218:function(t,e,r){"use strict";r.r(e);var a=r(0),u=Object(a.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"content"},[r("h1",{attrs:{id:"vue一些对比"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#vue一些对比","aria-hidden":"true"}},[t._v("#")]),t._v(" Vue一些对比")]),t._v(" "),r("h4",{attrs:{id:"一、methods和computed"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#一、methods和computed","aria-hidden":"true"}},[t._v("#")]),t._v(" 一、methods和computed")]),t._v(" "),r("ul",[r("li",[t._v("computed是计算属性,methods是方法。")]),t._v(" "),r("li",[t._v("computed计算属性是基于它们的依赖进行==缓存==的")]),t._v(" "),r("li",[t._v("computed只有在它的相关依赖发生改变时才会重新求值")]),t._v(" "),r("li",[t._v("而对于method ,只要发生重新渲染,method 调用==总会==执行该函数")]),t._v(" "),r("li",[t._v("==总之:数据量大,需要缓存的时候用computed;每次确实需要重新加载,不需要缓存时用methods==")])]),t._v(" "),r("h4",{attrs:{id:"二、computed和watch"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#二、computed和watch","aria-hidden":"true"}},[t._v("#")]),t._v(" 二、computed和watch")]),t._v(" "),r("ul",[r("li",[t._v("计算属性是==计算属性==,==侦听器watch==是侦听器watch")]),t._v(" "),r("li",[t._v("侦听器watch是侦听一个特定的值,当该值变化时执行特定的函数")])]),t._v(" "),r("h4",{attrs:{id:"三、-router和-route"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#三、-router和-route","aria-hidden":"true"}},[t._v("#")]),t._v(" 三、$router和$route")]),t._v(" "),r("ul",[r("li",[t._v("router为VueRouter的实例,相当于一个全局的路由器对象,里面含有很多属性和子对象")]),t._v(" "),r("li",[t._v("route相当于当前正在跳转的路由对象。。可以从里面获取name,path,params,query等")]),t._v(" "),r("li",[t._v("打印this.$route和this.$router,==两个同时存在==。")]),t._v(" "),r("li",[t._v("两者传参方式相同")])])])}],!1,null,null,null);e.default=u.exports}}]);
--------------------------------------------------------------------------------
/lib/app/root-mixins/activeHeaderLinks.js:
--------------------------------------------------------------------------------
1 | import store from '@app/store'
2 | import throttle from 'lodash.throttle'
3 |
4 | export default {
5 | mounted () {
6 | window.addEventListener('scroll', this.onScroll)
7 | },
8 | methods: {
9 | onScroll: throttle(function () {
10 | this.setActiveHash()
11 | }, 300),
12 | setActiveHash () {
13 | const sidebarLinks = [].slice.call(document.querySelectorAll('.sidebar-link'))
14 | const anchors = [].slice.call(document.querySelectorAll('.header-anchor'))
15 | .filter(anchor => sidebarLinks.some(sidebarLink => sidebarLink.hash === anchor.hash))
16 |
17 | const scrollTop = Math.max(
18 | window.pageYOffset,
19 | document.documentElement.scrollTop,
20 | document.body.scrollTop
21 | )
22 |
23 | for (let i = 0; i < anchors.length; i++) {
24 | const anchor = anchors[i]
25 | const nextAnchor = anchors[i + 1]
26 |
27 | const isActive = i === 0 && scrollTop === 0 ||
28 | (scrollTop >= anchor.parentElement.offsetTop + 10 &&
29 | (!nextAnchor || scrollTop < nextAnchor.parentElement.offsetTop - 10))
30 |
31 | if (isActive && decodeURIComponent(this.$route.hash) !== decodeURIComponent(anchor.hash)) {
32 | store.disableScrollBehavior = true
33 | this.$router.replace(decodeURIComponent(anchor.hash), () => {
34 | // execute after scrollBehavior handler.
35 | this.$nextTick(() => {
36 | store.disableScrollBehavior = false
37 | })
38 | })
39 | return
40 | }
41 | }
42 | }
43 | },
44 | beforeDestroy () {
45 | window.removeEventListener('scroll', this.onScroll)
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/docs/assets/js/18.faddd431.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[18],{198:function(s,t,a){"use strict";a.r(t);var e=a(0),n=Object(e.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var s=this,t=s.$createElement,a=s._self._c||t;return a("div",{staticClass:"content"},[a("h3",{attrs:{id:"像数-1-2-3-一样容易"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#像数-1-2-3-一样容易","aria-hidden":"true"}},[s._v("#")]),s._v(" 像数 1, 2, 3 一样容易")]),s._v(" "),a("div",{staticClass:"language-bash extra-class"},[a("pre",{pre:!0,attrs:{class:"language-bash"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 安装")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("yarn")]),s._v(" global "),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("add")]),s._v(" vuepress "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 或者:npm install -g vuepress")]),s._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 新建一个 markdown 文件")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("echo")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v("'# Hello VuePress!'")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" README.md\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 开始写作")]),s._v("\nvuepress dev "),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v(".")]),s._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 构建静态文件")]),s._v("\nvuepress build "),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v(".")]),s._v("\n")])])]),a("div",{staticClass:"warning custom-block"},[a("p",{staticClass:"custom-block-title"},[s._v("注意")]),s._v(" "),a("p",[s._v("请确保你的 Node.js 版本 >= 8。")])])])}],!1,null,null,null);t.default=n.exports}}]);
--------------------------------------------------------------------------------
/src/zh/algorithm/Charpter4.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar: auto
3 | sidebarDepth: 2
4 | ---
5 |
6 | # 第四章 编程基本功
7 | ## 4.1 字符类型统计器
8 | 请编写一个C程序,在终端用键盘输入字符串,以Ctrl+Z组合键表示输入完毕,统计输入的字符串中的空格符,制表符,换行符的个数,并显示统计的结果
9 |
10 |
11 | ## 4.2 计算字符的ASCII码
12 | 编写一个程序,在终端输入一个字符,输出它的ASCII码
13 |
14 | ## 4.3 嵌套if-slse语句的妙用
15 | 学校进行成绩分级管理,取消分数制,改为成绩分级评定。具体办法是:小于60分为E类;60分至70分(不含70分)为D类;70分至80分(不含)为C类;80分至90分(不含)为B类;90分以上为A类。设计一个程序,对输入的成绩进行等级划分
16 |
17 | ## 4.4 基于switch语句的译码器
18 | 给定一个成绩码表如下:
19 | |a|b|c|
20 | |-|--|--|
21 | |1|01|001|
22 | 又知有一个0/1字符串为:“001011101001011001”,编写一个C程序,按照给定的前缀码表为该字符串译码。
23 |
24 | ## 4.5 判断闰年
25 | 给定一个年份,判断该年是否是闰年。
26 |
27 | ## 4.6 指针变量作参数
28 | 编写一个函数inputArray,该函数被主函数调用,通过该函数实现向主函数中定义的数组输入数据
29 |
30 | ## 4.7 矩阵的转置运算
31 | 
32 |
33 | ## 4.8 矩阵的乘法运算
34 | 
35 |
36 | ## 4.9 巧用位运算
37 | 用位运算操作实现两个整数的交换。例如x1=5,x2=10;交换后x1=10,x2=5。
38 |
39 | ## 4.10 文件的读写(忽略)
40 | 创建一个后缀名为txt的文件,并向该文件中写入一个字符串,保存起来。再打开该文件,读出文件中的内容。
41 |
42 | ## 4.11 计算文件的大小(忽略)
43 | 编写一个C程序,用来计算指定文件的大小。
44 |
45 | ## 4.12 记录程序的运行时间
46 | 任意编写一段程序,要求记录并输出该段程序执行的时间。
47 |
48 | ## 4.13 十进制/二进制转化器
49 | 编写一个程序,将输入的十进制数转化为二进制表示。例如:输入十进制数64,输出二进制数表示1000000
50 |
51 | ## 4.14 计打印特殊图案
52 | 在应用C语言开发程序时,有时为了程序运行界面的美观,需要在屏幕上用字符构成一些特殊的图案用以装饰。请设计一个C程序,实现在屏幕上输出一个类似于下面的图案。
53 | 
54 |
55 | ## 4.15 打印杨辉三角
56 | 在屏幕上打印出一个6阶杨辉三角
57 |
58 | ## 4.16 复杂级数的前n项和
59 | 
60 |
61 | ## 4.17 寻找矩阵中的"鞍点"
62 | 在一个矩阵中,可能会有这样的元素:它在该行中最大,而在该列中最小。我们把这样的元素称为“鞍点”。一个矩阵中也可能没有“鞍点”。任意输入一个5x5的矩阵,寻找该矩阵中的“鞍点”,并将它在矩阵中的位置(行,列)输出。
63 |
64 | ## 4.18 n阶勒让德多项式求解
65 | 
66 | 测试:当n=5,x=1.6时,输出1.56
67 |
68 | ## 4.19 递归反向输出字符串
69 | 编写一个递归函数,实现将输入的任意长度的字符串反向输出的功能。例如输入字符串:ABCD,输出字符串:BCDA。
70 |
71 | ## 4.20 一年中的第几天
72 | 输入某年某月某日,判断这一天是这一年的第几天?
--------------------------------------------------------------------------------
/docs/assets/js/72.38ef9238.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[72],{213:function(e,n,t){"use strict";t.r(n);var r=t(0),a=Object(r.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var e=this,n=e.$createElement,t=e._self._c||n;return t("div",{staticClass:"content"},[t("h1",{attrs:{id:"vue路由"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#vue路由","aria-hidden":"true"}},[e._v("#")]),e._v(" Vue路由")]),e._v(" "),t("h4",{attrs:{id:"_1、路由-外置的-vue-router"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_1、路由-外置的-vue-router","aria-hidden":"true"}},[e._v("#")]),e._v(" 1、路由(外置的) vue-router")]),e._v(" "),t("div",{staticClass:"language- extra-class"},[t("pre",{pre:!0,attrs:{class:"language-text"}},[t("code",[e._v("import VueRouter from 'vue-router';\nimport Index from './components/index.vue';\nimport List from './components/index.vue';\nimport Login from './components/index.vue';\n\nVue.use(VueRouter); // 注册\nlet router = new VueRouter({\n routes:[{ // 定义多个路由\n path:'/index', \n component:Index\n },{\n path:'/list',\n component:List\n },{\n path:'/login',\n component:Login\n },{\n path:'/music',\n component:Music,\n children:[{ // 封装子路由\n path:'/comd',\n component:Comd\n },{\n path:'/search',\n component:Search\n }]\n }]\n})\n\n\napp.vue // 入口文件\n \n")])])]),t("h4",{attrs:{id:"_2、路由跳转路径"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#_2、路由跳转路径","aria-hidden":"true"}},[e._v("#")]),e._v(" 2、路由跳转路径")]),e._v(" "),t("div",{staticClass:"language- extra-class"},[t("pre",{pre:!0,attrs:{class:"language-text"}},[t("code",[e._v('推荐 \n\nrouter-link === a\nto === href\n')])])])])}],!1,null,null,null);n.default=a.exports}}]);
--------------------------------------------------------------------------------
/lib/default-theme/SidebarGroup.vue:
--------------------------------------------------------------------------------
1 |
2 |
31 |
32 |
33 |
43 |
44 |
78 |
--------------------------------------------------------------------------------
/src/zh/react/React生命周期.md:
--------------------------------------------------------------------------------
1 | # React生命周期
2 | #### 1、componentDidMount() // 组件挂载完成之后触发的生命周期 相当于vue的mounted
3 | ```
4 | componentDidMount(){
5 | setInterval(()=>{
6 | // 修改state的唯一方法
7 | // @param 要修改的数据
8 | // @param 修改完成之后的回调函数
9 | this.setState({
10 | index:this.state.index++
11 | },()=>{
12 | consloe.log(this.state.index)
13 | })
14 | },1000)
15 | }
16 |
17 | ```
18 | #### 2、componentWillMount() // 组件挂载之前 相当于vue的beforeMount
19 | #### 3、componentWillReceiveProps(nextProps) // 组件将要接收新的props vue没有
20 |
21 | ```
22 | // 和props相关的唯一一个生命周期
23 | // 执行完成之后,this.props指向新的props
24 | componentWillReceiveProps(nextProps){
25 | // 旧的props this.props
26 | // 新的props nextProps
27 |
28 | }
29 |
30 |
31 | ```
32 | #### 4、shouldComponentUpdate(nextProps,nextState) // 通过返回值判断组件是否需要更新,用于react优化,vue没有 true更新,false不更新
33 | ```
34 | shouldComponentUpdate(nextProps,nextState){
35 | // 旧的props this.props
36 | // 新的props nextProps
37 | // 旧的State this.state
38 | // 新的state nextState
39 | // 返回值是Boolean 默认true
40 | }
41 |
42 |
43 | ```
44 | #### 5、componentWillUpdate // 组件将要更新 相当于vue的beforeUpdate
45 | #### 6、componentDidUpdate // 组件更新完成 相当于vue的updated
46 | #### 7、componentWillUnmount() // 组件将要卸载
47 | #### 8、unmountComponentAtNode() // 卸载组件
48 | ```
49 | ReactDom.unmountComponentAtNode(document.getElementById('root'))
50 | ```
51 | #### 9、分为三个阶段
52 | 1. 实例化阶段
53 |
54 | ```
55 | 首次使用一个组件类时会有getDefaultProps
56 | 对于组件类的所有后续应用没有getDefaultProps
57 | 1、getDefaultProps
58 | 2、getInitialState
59 | 3、componentWillMount
60 | 4、render
61 | 5、componentDidMount
62 | ```
63 | 2. 更新阶段(存在期)
64 |
65 |
66 | ```
67 | 1. componentWillReceiveProps
68 | 2. shouldComponentUpdate
69 | 3. componentWillUpdate
70 | 4. render
71 | 5. componentDidUpdate
72 | ```
73 | 3. 销毁&清理期
74 |
75 | ```
76 | componentWillUnmount
77 | ```
78 |
--------------------------------------------------------------------------------
/lib/app/root-mixins/updateMeta.js:
--------------------------------------------------------------------------------
1 | export default {
2 | created () {
3 | if (this.$ssrContext) {
4 | this.$ssrContext.title = this.$title
5 | this.$ssrContext.lang = this.$lang
6 | this.$ssrContext.description = this.$page.description || this.$description
7 | }
8 | },
9 |
10 | mounted () {
11 | // update title / meta tags
12 | this.currentMetaTags = new Set()
13 |
14 | const updateMeta = () => {
15 | document.title = this.$title
16 | document.documentElement.lang = this.$lang
17 | const userMeta = this.$page.frontmatter.meta || []
18 | const meta = userMeta.slice(0)
19 | const useGlobalDescription = userMeta.filter(m => m.name === 'description').length === 0
20 |
21 | // #665 Avoid duplicate description meta at runtime.
22 | if (useGlobalDescription) {
23 | meta.push({ name: 'description', content: this.$description })
24 | }
25 |
26 | // Including description meta coming from SSR.
27 | const descriptionMetas = document.querySelectorAll('meta[name="description"]')
28 | if (descriptionMetas.length) {
29 | descriptionMetas.forEach(m => this.currentMetaTags.add(m))
30 | }
31 |
32 | this.currentMetaTags = new Set(updateMetaTags(meta, this.currentMetaTags))
33 | }
34 | this.$watch('$page', updateMeta)
35 | updateMeta()
36 | },
37 |
38 | beforeDestroy () {
39 | updateMetaTags(null, this.currentMetaTags)
40 | }
41 | }
42 |
43 | function updateMetaTags (meta, current) {
44 | if (current) {
45 | [...current].forEach(c => {
46 | document.head.removeChild(c)
47 | })
48 | }
49 | if (meta) {
50 | return meta.map(m => {
51 | const tag = document.createElement('meta')
52 | Object.keys(m).forEach(key => {
53 | tag.setAttribute(key, m[key])
54 | })
55 | document.head.appendChild(tag)
56 | return tag
57 | })
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/zh/react/redux.md:
--------------------------------------------------------------------------------
1 | # Redux
2 | ##### 1、redux是什么?
3 | - 是一个框架
4 | - 跨组件通信
5 | #### 分四块内容
6 | 1. actionTypes
7 | 2. actions => {type, payload}
8 | 3. reducer
9 | 4. store
10 |
11 | #### redux三大原则
12 | 1. 单一数据源
13 | 2. State 是只读的
14 | 3. 使用纯函数来执行修改
15 | ##### 2、provider
16 | - 只有一个属性,是store
17 | - 顶层容器
18 | ##### 3、connect
19 | - 伪高阶函数
20 | - 4个参数
21 |
22 | ```
23 | 1、把redux中state映射成的props传递到组件中去 // 获取state数据
24 | const mapStatetoProps = (state,ownProps)=>{
25 | // state redux存储的数据
26 | // ownProps 组件调用时传过来的props
27 | // 返回一个对象
28 | }
29 |
30 | 2、把dispatch操作封装在当前函数里,传递到组件中 // 封装方法
31 | const mapDispatchtoProps = (dispatch, ownProps)=>{
32 | // 返回一个对象
33 | return {
34 | fetchList:()=>{
35 | axios.get('路径')
36 | .then(res=>{
37 | // 触发dispatch
38 | dispatch({
39 | type:'FETCH_LIST',
40 | payload:res.data
41 | })
42 | })
43 | }
44 | }
45 |
46 | }
47 |
48 | 3、合并props
49 | const mergeProps = (stateProps, dispatchProps, ownProps)=>{
50 | // stateProps 是mapStateToProps的返回值
51 | // dispatchProps 是mapDispatchtoProps的返回值
52 | // ownProps 是调用时传入的props
53 | return {...stateProps, ...dispatchProps, ...ownProps}
54 |
55 | }
56 |
57 | 4、可选配置项
58 | const options = {
59 | pure:true
60 | // pure:表示state需要深拷贝才会响应
61 | // true 深拷贝(默认true 深拷贝)
62 | // false 浅拷贝深拷贝都可以
63 | }
64 | ```
65 | ##### 4、reducer
66 | - 有两个参数:state action
67 | - 接收先前的 state 和 action,并返回新的 state
68 | ##### 5、深拷贝和浅拷贝
69 | - 深拷贝 ...
70 | - 浅拷贝 Object.assign()
71 | ##### 5、store
72 | - createStore接收两个参数
73 | > reducers 存储数据和修改数据
74 |
75 | > applyMiddleware 应用的中间件
76 |
77 | ##### 6、combineReducers // 合并
78 |
79 | ```
80 | import {combineReducers} from 'redux';
81 | import cart from './cart';
82 | import my from './my';
83 |
84 | export default combineReducers({
85 | cart,
86 | my
87 | })
88 | ```
89 |
--------------------------------------------------------------------------------
/docs/assets/js/45.d5a892d0.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[45],{169:function(t,e,s){"use strict";s.r(e);var n=s(0),a=Object(n.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"content"},[s("h1",{attrs:{id:"小程序组件"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#小程序组件","aria-hidden":"true"}},[t._v("#")]),t._v(" 小程序组件")]),t._v(" "),s("h5",{attrs:{id:"什么是组件"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#什么是组件","aria-hidden":"true"}},[t._v("#")]),t._v(" 什么是组件")]),t._v(" "),s("blockquote",[s("p",[t._v("组件就是将一个功能进行封装,组件是视图层的基本组成单元,有自己独特的功能")])]),t._v(" "),s("h5",{attrs:{id:"组件的规范"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#组件的规范","aria-hidden":"true"}},[t._v("#")]),t._v(" 组件的规范")]),t._v(" "),s("ol",[s("li",[t._v("结构")]),t._v(" "),s("li",[t._v("样式")]),t._v(" "),s("li",[t._v("逻辑")]),t._v(" "),s("li",[t._v("通信方式")]),t._v(" "),s("li",[t._v("生命周期")]),t._v(" "),s("li",[t._v("可组合(可以嵌套)")]),t._v(" "),s("li",[t._v("定义组件")]),t._v(" "),s("li",[t._v("调用组件(标签的形式)")])]),t._v(" "),s("h5",{attrs:{id:"组件的创建"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#组件的创建","aria-hidden":"true"}},[t._v("#")]),t._v(" 组件的创建")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v("1.小程序中组件由4个文件组成,.json .wxmll .wxss .js\n2.创建组件实例需要通过Compoent(Object) 函数创建\n3.创建组件需要在组件的json文件中定义 component:true 字段指定为一个组件\n4.组件中的基础选项\n (1)Properties: 接受的数据\n (2)Data: 内部数据\n (3)Methods: 处理函数\n5.使用组件\n6.需要在对应的页面或者组件的json文件中定义 usingComponents: {} 选项\n usingComponets: {\n '名-称': '组件路径' \n }\n7.在页面中可以实用 <名-称/>\n8.名称中不能出现大写字母,规则就是(字母_-)\n9.组件的组合可以实用slot插槽来完成,和vue一样,只不过没有作用域插槽, 可以有命名插槽和默认插槽\n10.组件的通信可以通过props传递参数(父子), 自定义事件(子父)\n (1)父子 \n (2)子父 组件内部通过this.triggerEvent(‘test’, {detail:对象})\n")])])])])}],!1,null,null,null);e.default=a.exports}}]);
--------------------------------------------------------------------------------
/docs/assets/js/75.fd9bf91f.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[75],{215:function(e,t,a){"use strict";a.r(t);var i=a(0),r=Object(i.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"content"},[a("h1",{attrs:{id:"vue钩子"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#vue钩子","aria-hidden":"true"}},[e._v("#")]),e._v(" Vue钩子")]),e._v(" "),a("h4",{attrs:{id:"_1、钩子函数"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#_1、钩子函数","aria-hidden":"true"}},[e._v("#")]),e._v(" 1、钩子函数")]),e._v(" "),a("p",[e._v("指令定义函数提供了几个钩子函数(可选):")]),e._v(" "),a("ul",[a("li",[a("p",[e._v("bind: 只调用一次,指令第一次绑定到元素时调用,用这个钩子函数可以定义一个在绑定时执行一次的初始化动作。")])]),e._v(" "),a("li",[a("p",[e._v("inserted: 被绑定元素插入父节点时调用(父节点存在即可调用,不必存在于 document 中)。")])]),e._v(" "),a("li",[a("p",[e._v("update: 被绑定元素所在的模板更新时调用,而不论绑定值是否变化。通过比较更新前后的绑定值,可以忽略不必要的模板更新(详细的钩子函数参数见下)。")])]),e._v(" "),a("li",[a("p",[e._v("componentUpdated: 被绑定元素所在模板完成一次更新周期时调用。")])]),e._v(" "),a("li",[a("p",[e._v("unbind: 只调用一次, 指令与元素解绑时调用。")])])]),e._v(" "),a("h4",{attrs:{id:"_2、钩子函数参数"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#_2、钩子函数参数","aria-hidden":"true"}},[e._v("#")]),e._v(" 2、钩子函数参数")]),e._v(" "),a("p",[e._v("钩子函数的参数有:")]),e._v(" "),a("ol",[a("li",[e._v("el: 指令所绑定的元素,可以用来直接操作 DOM 。")]),e._v(" "),a("li",[e._v("binding: 一个对象,包含以下属性:")])]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v('name: 指令名,不包括 v- 前缀\nvalue: 指令的绑定值, 例如: v-my-directive="1 + 1", value 的值是 2。\noldValue: 指令绑定的前一个值,仅在 update 和 componentUpdated 钩子中可用。无论值是否改变都可用。\nexpression: 绑定值的表达式或变量名。 例如 v-my-directive="1 + 1" , expression 的值是 "1 + 1"。\narg: 传给指令的参数。例如 v-my-directive:foo, arg 的值是 "foo"。\nmodifiers: 一个包含修饰符的对象。 例如: v-my-directive.foo.bar, 修饰符对象 modifiers 的值是 { foo: true, bar: true }。\n')])])]),a("ol",{attrs:{start:"3"}},[a("li",[e._v("vnode: Vue 编译生成的虚拟节点。")]),e._v(" "),a("li",[e._v("oldVnode: 上一个虚拟节点,仅在 update 和 componentUpdated 钩子中可用。")])])])}],!1,null,null,null);t.default=r.exports}}]);
--------------------------------------------------------------------------------
/docs/assets/js/70.6909a909.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[70],{217:function(t,a,e){"use strict";e.r(a);var r=e(0),v=Object(r.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"content"},[e("h1",{attrs:{id:"vue动画"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#vue动画","aria-hidden":"true"}},[t._v("#")]),t._v(" Vue动画")]),t._v(" "),e("h4",{attrs:{id:"_1、transition"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#_1、transition","aria-hidden":"true"}},[t._v("#")]),t._v(" 1、transition")]),t._v(" "),e("ol",[e("li",[t._v('name="" -> 手写')]),t._v(" "),e("li",[t._v("animate.css")]),t._v(" "),e("li",[t._v("velocity.js")])]),t._v(" "),e("h4",{attrs:{id:"_2、进入动画-从0-1"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#_2、进入动画-从0-1","aria-hidden":"true"}},[t._v("#")]),t._v(" 2、进入动画 从0-1")]),t._v(" "),e("ol",[e("li",[t._v("v-enter // 进入前")]),t._v(" "),e("li",[t._v("v-enter-active // 定义进入过渡生效时的状态")]),t._v(" "),e("li",[t._v("v-enter-to // 定义进入过渡结束时的状态")])]),t._v(" "),e("h4",{attrs:{id:"_3、离开动画-从1-0"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#_3、离开动画-从1-0","aria-hidden":"true"}},[t._v("#")]),t._v(" 3、离开动画 从1-0")]),t._v(" "),e("ol",[e("li",[t._v("v-leave // 离开前")]),t._v(" "),e("li",[t._v("v-leave-active // 离开中")]),t._v(" "),e("li",[t._v("v-leave-to // 离开后")])]),t._v(" "),e("h4",{attrs:{id:"_4、过渡持续时间"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#_4、过渡持续时间","aria-hidden":"true"}},[t._v("#")]),t._v(" 4、过渡持续时间")]),t._v(" "),e("ul",[e("li",[t._v(":duration='1000'")]),t._v(" "),e("li",[t._v(":duration='{enter:'1000',leave:'1000'}'")])]),t._v(" "),e("h4",{attrs:{id:"_5、javascript钩子"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#_5、javascript钩子","aria-hidden":"true"}},[t._v("#")]),t._v(" 5、JavaScript钩子")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("v-on:before-enter \nv-on:enter \nv-on:after-enter \nv-on:enter-cancelled // 取消动画(删除)\n")])])])])}],!1,null,null,null);a.default=v.exports}}]);
--------------------------------------------------------------------------------
/docs/assets/js/23.7c6d25d9.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[23],{193:function(t,a,e){"use strict";e.r(a);var r=e(0),i=Object(r.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"content"},[e("h1",{attrs:{id:"浏览器"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#浏览器","aria-hidden":"true"}},[t._v("#")]),t._v(" 浏览器")]),t._v(" "),e("h3",{attrs:{id:"浏览器历史"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#浏览器历史","aria-hidden":"true"}},[t._v("#")]),t._v(" 浏览器历史")]),t._v(" "),e("p",[t._v("最开始是3w浏览器,刚出来就很快死掉了,后来就出来了Mosaic浏览器,它是第一个普遍使用并且可以显示图片的网页浏览器。")]),t._v(" "),e("h3",{attrs:{id:"什么是浏览器"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#什么是浏览器","aria-hidden":"true"}},[t._v("#")]),t._v(" 什么是浏览器")]),t._v(" "),e("p",[t._v("浏览器分为两部分 ,一是shell部分(外壳),二是内核;用户可以看到和操作的部分是外壳,看不到的能够处理代码并且可以把代码完整显示出来的是内核部分,内核是最主要的一部分。")]),t._v(" "),e("h3",{attrs:{id:"内核"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#内核","aria-hidden":"true"}},[t._v("#")]),t._v(" 内核")]),t._v(" "),e("p",[t._v("内核大致分为两大部分,一是渲染引擎,二是js引擎;渲染引擎主要负责的是html和css一些基础语法的识别以及更高效的去绘图页面;js引擎越来越独立主要是负责JavaScript的")]),t._v(" "),e("h3",{attrs:{id:"主流浏览器机器内核-专业知识"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#主流浏览器机器内核-专业知识","aria-hidden":"true"}},[t._v("#")]),t._v(" 主流浏览器机器内核(专业知识)")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("浏览器")]),t._v(" "),e("th",{staticStyle:{"text-align":"right"}},[t._v("内核")])])]),t._v(" "),e("tbody",[e("tr",[e("td",[t._v("IE")]),t._v(" "),e("td",{staticStyle:{"text-align":"right"}},[t._v("trident")])]),t._v(" "),e("tr",[e("td",[t._v("Chrome")]),t._v(" "),e("td",{staticStyle:{"text-align":"right"}},[t._v("webkit/blink")])]),t._v(" "),e("tr",[e("td",[t._v("firefox")]),t._v(" "),e("td",{staticStyle:{"text-align":"right"}},[t._v("Gecko")])]),t._v(" "),e("tr",[e("td",[t._v("opera")]),t._v(" "),e("td",{staticStyle:{"text-align":"right"}},[t._v("Presto")])]),t._v(" "),e("tr",[e("td",[t._v("safari")]),t._v(" "),e("td",{staticStyle:{"text-align":"right"}},[t._v("webkit")])])])])])}],!1,null,null,null);a.default=i.exports}}]);
--------------------------------------------------------------------------------
/lib/default-theme/SWUpdatePopup.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | {{message}}
8 |
9 |
10 |
11 |
12 |
13 |
60 |
61 |
86 |
--------------------------------------------------------------------------------
/test/markdown/link.spec.js:
--------------------------------------------------------------------------------
1 | import { Md } from './util'
2 | import link from '@/markdown/link.js'
3 | import { dataReturnable } from '@/markdown/index.js'
4 |
5 | const mdL = Md().use(link, {
6 | target: '_blank',
7 | rel: 'noopener noreferrer'
8 | })
9 |
10 | dataReturnable(mdL)
11 |
12 | const internalLinkAsserts = {
13 | // START abosolute path usage
14 | '/': '/',
15 |
16 | '/foo/': '/foo/',
17 | '/foo/#hash': '/foo/#hash',
18 |
19 | '/foo/two.md': '/foo/two.html',
20 | '/foo/two.html': '/foo/two.html',
21 | // END abosolute path usage
22 |
23 | // START relative path usage
24 | 'README.md': './',
25 | './README.md': './',
26 |
27 | 'index.md': './',
28 | './index.md': './',
29 |
30 | 'one.md': './one.html',
31 | './one.md': './one.html',
32 |
33 | 'foo/README.md': './foo/',
34 | './foo/README.md': './foo/',
35 |
36 | 'foo/README.md#hash': './foo/#hash',
37 | './foo/README.md#hash': './foo/#hash',
38 |
39 | '../README.md': './../',
40 | '../README.md#hash': './../#hash',
41 |
42 | '../foo.md': './../foo.html',
43 | '../foo.md#hash': './../foo.html#hash',
44 |
45 | '../foo/one.md': './../foo/one.html',
46 | '../foo/one.md#hash': './../foo/one.html#hash'
47 | // END relative path usage
48 | }
49 |
50 | const externalLinks = [
51 | '[vue](https://vuejs.org/)',
52 | '[vue](http://vuejs.org/)',
53 | '[some **link** with `code`](https://google.com)' // #496
54 | ]
55 |
56 | describe('link', () => {
57 | test('should convert internal links to router links correctly', () => {
58 | for (const before in internalLinkAsserts) {
59 | const input = `[${before}](${before})`
60 | const output = mdL.render(input)
61 | const after = getCompiledLink(output)
62 | expect(after).toBe(internalLinkAsserts[before])
63 | }
64 | })
65 |
66 | test('should render external links correctly', () => {
67 | for (const link of externalLinks) {
68 | const { html } = mdL.render(link)
69 | expect(html).toMatchSnapshot()
70 | }
71 | })
72 | })
73 |
74 | function getCompiledLink (output) {
75 | const { data: { routerLinks }} = output
76 | return routerLinks[0]
77 | }
78 |
--------------------------------------------------------------------------------
/src/zh/interview/longhu.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 龙湖地产
3 | sidebar: auto
4 | sidebarDepth: 2
5 | ---
6 | # 龙湖地产
7 | ## 1. 块级和行内元素元素有哪些,它们有什么区别?
8 |
9 | ## 2. 为什么要少用Iframe?
10 |
11 |
12 |
13 | ## 3. 用css写出这样一个图形 (上下左右居中)
14 |
15 |
16 |
17 | ## 4. 写画如下代码的页面展示效果图,c盒子有position:relative 和没position值有什么区别?
18 | ```js
19 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | ```
45 |
46 | ## 5. call,apply和bind的区别列举使用方法
47 |
48 |
49 | ## 6. 写出下面代码的输入值
50 | ```js
51 | 6.1 (function(x){
52 | delete x;
53 | return x;
54 | })(1);
55 |
56 |
57 | 6.2 var y = 1, x = y = typeof x;
58 | console.log(x);
59 |
60 |
61 | 6.3 (function f(f){
62 | return typeof f();
63 | })(function(){ return 1; });
64 |
65 |
66 | 6.4 !!typeof(null)
67 | ```
68 |
69 | ## 7. 写出如下代码的运行结果
70 | ```js
71 | function Fun(){
72 | var printNum= function(){
73 | console.log(1);
74 | }
75 | return this;
76 | }
77 | Fun.printNum = function(){
78 | console.log(2);
79 | }
80 | Fun.prototype.printNum = function(){
81 | console.log(3);
82 | }
83 | var printNum = function(){
84 | console.log(4);
85 | }
86 | function printNum (){
87 | console.log(5);
88 | }
89 |
90 | Fun().printNum();
91 | printNum();
92 | Fun();
93 | printNum();
94 | new Fun().printNum();
95 | new new Fun().printNum();
96 | ```
97 | ## 8. var arr = [1,2,[3,4,[5]],6,[7,[8,9,[10,11,[12]]]]]请写一个方法把数组拍扁成普通数组。
98 | ```js
99 | arr.toString();
100 | ```
101 |
102 | ## 9. 写一写你常用和重要的es6知识点
103 |
104 | ## 10. 同步和异步的概念和区别。
105 |
106 | ## 11. 写出常见的http状态码及含义。
107 |
108 | ## 12. [数组去重的多种方法](https://m.jb51.net/show/118657)
109 |
110 |
111 | ## 13.url从输入地址栏到打开页面一系列操作描述一下
112 |
113 | ## 14.vue的相关知识
114 |
--------------------------------------------------------------------------------
/src/zh/guide/README.md:
--------------------------------------------------------------------------------
1 | # 介绍
2 |
3 | VuePress 由两部分组成:一部分是支持用 Vue 开发主题的极简静态网站生成器,另一个部分是为书写技术文档而优化的默认主题。它的诞生初衷是为了支持 Vue 及其子项目的文档需求。
4 |
5 | 每一个由 VuePress 生成的页面都带有预渲染好的 HTML,也因此具有非常好的加载性能和搜索引擎优化(SEO)。同时,一旦页面被加载,Vue 将接管这些静态内容,并将其转换成一个完整的单页应用(SPA),其他的页面则会只在用户浏览到的时候才按需加载。
6 |
7 | ## 它是如何工作的?
8 |
9 | 事实上,一个 VuePress 网站是一个由 [Vue](http://vuejs.org/)、[Vue Router](https://github.com/vuejs/vue-router) 和 [webpack](http://webpack.js.org/) 驱动的单页应用。如果你以前使用过 Vue 的话,当你在开发一个自定义主题的时候,你会感受到非常熟悉的开发体验,你甚至可以使用 Vue DevTools 去调试你的自定义主题。
10 |
11 | 在构建时,我们会为应用创建一个服务端渲染(SSR)的版本,然后通过虚拟访问每一条路径来渲染对应的HTML。这种做法的灵感来源于 [Nuxt](https://nuxtjs.org/) 的 `nuxt generate` 命令,以及其他的一些项目,比如 [Gatsby](https://www.gatsbyjs.org/)。
12 |
13 | ## 特性
14 |
15 | - 为技术文档而优化的 [内置 Markdown 拓展](./markdown.md)
16 | - [在 Markdown 文件中使用 Vue 组件的能力](./using-vue.md)
17 | - [Vue 驱动的自定义主题系统](./custom-themes.md)
18 | - [自动生成 Service Worker](../config/README.md#serviceworker)
19 | - [Google Analytics 集成](../config/README.md#ga)
20 | - [基于 Git 的 “最后更新时间”](../default-theme-config/README.md#最后更新时间)
21 | - [多语言支持](./i18n.md)
22 | - 默认主题包含:
23 | - 响应式布局
24 | - [可选的主页](../default-theme-config/README.md#首页)
25 | - [简洁的开箱即用的标题搜索](../default-theme-config/README.md#内置搜索)
26 | - [Algolia 搜索](../default-theme-config/README.md#algolia-搜索)
27 | - 可自定义的[导航栏](../default-theme-config/README.md#导航栏) 和[侧边栏](../default-theme-config/README.md#侧边栏)
28 | - [自动生成的 GitHub 链接和页面的编辑链接](../default-theme-config/README.md#git-仓库和编辑链接)
29 |
30 | ## Todo
31 |
32 | VuePress 仍然处于开发中,这里有一些目前还不支持、但已经在计划中的特性:
33 |
34 | - 插件
35 | - 博客系统
36 |
37 | 我们欢迎你为 VuePress 的开发作出贡献。
38 |
39 | ## 为什么不是...?
40 |
41 | ### Nuxt
42 |
43 | VuePress 能做的事情,Nuxt 理论上确实能够胜任,但 Nuxt 是为构建应用程序而生的,而 VuePress 则专注在以内容为中心的静态网站上,同时提供了一些为技术文档定制的开箱即用的特性。
44 |
45 | ### studyify / Docute
46 |
47 | 这两个项目同样都是基于 Vue,然而它们都是完全的运行时驱动,因此对 SEO 不够友好。如果你并不关注 SEO,同时也不想安装大量依赖,它们仍然是非常好的选择!
48 |
49 | ### Hexo
50 |
51 | Hexo 一直驱动着 Vue 的文档 —— 事实上,在把我们的主站从 Hexo 迁移到 VuePress 之前,我们可能还有很长的路要走。Hexo 最大的问题在于他的主题系统太过于静态以及过度地依赖纯字符串,而我们十分希望能够好好地利用 Vue 来处理我们的布局和交互,同时,Hexo 的 Markdown 渲染的配置也不是最灵活的。
52 |
53 | ### GitBook
54 |
55 | 我们的子项目文档一直都在使用 GitBook。GitBook 最大的问题在于当文件很多时,每次编辑后的重新加载时间长得令人无法忍受。它的默认主题导航结构也比较有限制性,并且,主题系统也不是 Vue 驱动的。GitBook 背后的团队如今也更专注于将其打造为一个商业产品而不是开源工具。
56 |
--------------------------------------------------------------------------------
/src/zh/standard/Project.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar: auto
3 | sidebarDepth: 2
4 | ---
5 | # 开发流程
6 | ## 图解
7 | 
8 | ## 需求
9 | ### 评审
10 | 召集需求涉及到的UI、开发、产品、测试人员整理业务流程,同步信息,明确分工
11 | 明确需求目的,考虑当前需求设计是否可满足目的
12 | 整理流程中如果涉及的其他人员,则召集商讨
13 | 如需求设计上影响现有业务功能,应要求产品重新设计实现方案,然后重新评审
14 | ### 注意事项
15 | 业务流程同步:评审后重新梳理流程,存在疑问处及时找产品沟通
16 | 周边需求依赖:评审功能与依赖功能并行开发,由于前置需求未完成导致当前需求时间成本被压缩
17 | 埋点需求:提前与产品明确是否需要埋点
18 | 造数据:提前了解测试数据制造的困难程度,预估测试时间--->有些场景下的测试数据非常难造
19 | 并发量:后端机器是否能够承担新需求下的并发量,如果无法承担的话必须给出后续方案
20 | 自测:由于开发人员不予提供线上账号,因此自测也需要一名测试人员做线上回归测试
21 | 兼容范围:pc端需明确要兼容哪些浏览器,移动端需明确android与ios兼容版本以及哪些移动端浏览器
22 | ## 开发
23 | ### 评审
24 | #### 原型图评审
25 | 向产品明确原型图在应用中所处位置以及入口的显示条件,确认原型图的正确性
26 | #### 设计稿评审
27 | 观察线上应用设计风格与当前设计稿风格是否一致(色调,字号,行高,对齐方式)是否一致
28 | 观察设计稿中哪些部分需要切图
29 | 判断设计稿中组件是否开发过,避免重复造轮子
30 | #### 技术实现评审
31 | 如存在不易实现的功能,第一时间与产品沟通其他降级的实现方案
32 | #### 排期
33 | 找到相关开发(前端,后端,app)商讨需求实现技术细节,明确产出接口格式时间与接口联调时间
34 | #### 代码管理
35 | 为防止合并代码时过多的代码冲突问题,建议使用分支时遵循以下标准
36 | 每次push前先拉取线上分支代码
37 | 开发新功能或者修复bug时一定要基于线上代码分支创建新分支,每个分支只对应一个jira号或一个待修复的bug问题
38 | 分支名以f_(提交人)_(jira号)方式命名,对jira进行bug修复时使用f_(提交人)_fix_(bug内容)_(jira号)
39 | commit格式规则:每行message描述一个功能点,message格式为$(操作):$(描述),操作一般为add,del,upd分别代表新增、删除、更新三种操作
40 | ### 开发与调试
41 | 一般开发时不会从造轮子开始,项目中一般会有组件库供开发人员使用,但也会有一些老旧的项目中组件库版本较低,无法满足需求,
42 | 因此在开发前一定要对项目现有组件进行评估,确认是否需要重新开发组件,确保进度如期进行。
43 |
44 | #### pc端
45 | 推荐优雅降级方式开发,先chrome,firefox,然后再针对兼容性较差的如ie等进行兼容处理
46 |
47 | #### 移动端
48 | 移动端页面兼容性相较于pc端较好,但需真机调试,为方便调试移动页面,这里推荐使用spy-debugger来让pc端做代理,具体使用
49 | 请查阅github文档。
50 |
51 | ## 联调
52 | 和后端对接真实接口
53 |
54 | ## 自测
55 | 自测环节与环境数据关联很大,需要前后端共同完成,如果自测所需数据涉及范围较广,则需要找齐相关人员协助上线
56 |
57 | ## 提测
58 | 自测完成后开始进行真实环境测试
59 |
60 | ## bug反馈
61 |
62 |
63 | ## 部署上线
64 |
65 |
66 |
67 | ## 开发规范
68 | * 命名规范(文件命名,变量,函数,class, id) 驼峰, - _ 约定法
69 | * 目录规范(目录如何建立) 划分目录结构 约定法
70 | * 版本规范() 挑选稳定版本 记录版本号 如果版本升级,需要总结版本差异
71 | * 编码规范(注释,.... 语法) eslint语法 JSDoc注释
72 | * 适配规则(pc,移动) 分辨率调整
73 | * 接口规范(成功,失败,状态码,安全) 和后端约定
74 |
75 | ## 项目搭建
76 | * vue-cli脚手架搭建 -- 自定义项目用到的需求
77 | * 选择ui框架
78 | * 抽离公共逻辑,划分功能组件
79 | * 目录构建
80 | * 路由规划
81 | * ajax请求配置
82 | * mock生成
83 | * 架构文档
84 | * 方案整理(用到哪些技术,用到哪些特性)
85 |
86 | ## 代码管理
87 | * git & svn
88 | * 分支管理
89 | * 任务划分
90 | * 功能排期
91 |
92 | # 目的
93 | 整理和规划,提升开发效率
--------------------------------------------------------------------------------
/lib/prepare/index.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const fs = require('fs-extra')
3 | const resolveOptions = require('./resolveOptions')
4 | const { genRoutesFile, genComponentRegistrationFile } = require('./codegen')
5 | const { writeTemp, writeEnhanceTemp } = require('./util')
6 | const logger = require('../util/logger')
7 | const chalk = require('chalk')
8 |
9 | module.exports = async function prepare (sourceDir) {
10 | // 1. load options
11 | const options = await resolveOptions(sourceDir)
12 |
13 | // 2. generate routes & user components registration code
14 | const routesCode = await genRoutesFile(options)
15 | const componentCode = await genComponentRegistrationFile(options)
16 |
17 | await writeTemp('routes.js', [
18 | componentCode,
19 | routesCode
20 | ].join('\n'))
21 |
22 | // 3. generate siteData
23 | const dataCode = `export const siteData = ${JSON.stringify(options.siteData, null, 2)}`
24 | await writeTemp('siteData.js', dataCode)
25 |
26 | // 4. handle user override
27 | const overridePath = path.resolve(sourceDir, '.vuepress/override.styl').replace(/[\\]+/g, '/')
28 | const hasUserOverride = fs.existsSync(overridePath)
29 | await writeTemp('override.styl', hasUserOverride ? `@import(${JSON.stringify(overridePath)})` : ``)
30 |
31 | const stylePath = path.resolve(sourceDir, '.vuepress/style.styl').replace(/[\\]+/g, '/')
32 | const hasUserStyle = fs.existsSync(stylePath)
33 | await writeTemp('style.styl', hasUserStyle ? `@import(${JSON.stringify(stylePath)})` : ``)
34 |
35 | // Temporary tip, will be removed at next release.
36 | if (hasUserOverride && !hasUserStyle) {
37 | logger.tip(
38 | `${chalk.magenta('override.styl')} has been split into 2 APIs, we recommend you upgrade to continue.\n` +
39 | ` See: ${chalk.magenta('https://vuepress.vuejs.org/default-theme-config/#simple-css-override')}`
40 | )
41 | }
42 |
43 | // 5. handle enhanceApp.js
44 | const enhanceAppPath = path.resolve(sourceDir, '.vuepress/enhanceApp.js')
45 | await writeEnhanceTemp('enhanceApp.js', enhanceAppPath)
46 |
47 | // 6. handle the theme enhanceApp.js
48 | await writeEnhanceTemp('themeEnhanceApp.js', options.themeEnhanceAppPath)
49 |
50 | return options
51 | }
52 |
--------------------------------------------------------------------------------
/docs/assets/js/46.b2597f58.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[46],{168:function(e,t,l){"use strict";l.r(t);var s=l(0),r=Object(s.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var e=this,t=e.$createElement,l=e._self._c||t;return l("div",{staticClass:"content"},[l("h1",{attrs:{id:"小程序组件化"}},[l("a",{staticClass:"header-anchor",attrs:{href:"#小程序组件化","aria-hidden":"true"}},[e._v("#")]),e._v(" 小程序组件化")]),e._v(" "),l("h5",{attrs:{id:"wxml节点信息api"}},[l("a",{staticClass:"header-anchor",attrs:{href:"#wxml节点信息api","aria-hidden":"true"}},[e._v("#")]),e._v(" wxml节点信息API")]),e._v(" "),l("ul",[l("li",[e._v("在小程序中使用"),l("strong",[e._v("wx.createSelectorQuery()"),l("strong",[e._v("获取到")]),e._v("SelectorQuery")]),e._v("对象,这个对象提供了对应的节点操作方法\n"),l("ul",[l("li",[l("strong",[e._v("in(this)")]),e._v(" 将节点选区范围指向当前组件,默认只会查找当期页面")]),e._v(" "),l("li",[l("strong",[e._v("select()")]),e._v(" 根据css选择器查询到匹配结果的第一个元素节点,返回的 NodesRef对象实例")]),e._v(" "),l("li",[l("strong",[e._v("selectAll()")]),e._v(" 和select一样只不过他可以匹配多个")]),e._v(" "),l("li",[l("strong",[e._v("selectViewport()")]),e._v(" 选择显示区域(页面),可用于获取显示区域的尺寸、滚动位置等信息,返回一个NodesRef对象实例。")]),e._v(" "),l("li",[l("strong",[e._v("exec()")]),e._v(" 执行所有的请求,请求结果按请求次序构成数组,在callback的第一个参数中返回。")])])])]),e._v(" "),l("h5",{attrs:{id:"nodesref对象"}},[l("a",{staticClass:"header-anchor",attrs:{href:"#nodesref对象","aria-hidden":"true"}},[e._v("#")]),e._v(" NodesRef对象")]),e._v(" "),l("p",[e._v("1、 "),l("strong",[e._v("boundingClientRect([callback])")])]),e._v(" "),l("blockquote",[l("p",[e._v("获取节点信息, 返回值相对于显示区域,以像素为单位。\n返回节点的信息有"),l("strong",[e._v("left、right、top、bottom、width、height")]),e._v(" 如果提供了callback回调函数,在执行selectQuery的exec方法后,节点信息会在callback中返回")])]),e._v(" "),l("p",[e._v("2、"),l("strong",[e._v("scrollOffset([callback])")])]),e._v(" "),l("blockquote",[l("p",[e._v("获取滚动位置信息,只针对与scroll-view组件以及viewport页面起作用,返回值是"),l("strong",[e._v("scrollLeft、scrollTop")]),e._v(",如果提供了callback回调函数,在执行selectQuery的exec方法后,节点信息会在callback中返回")])]),e._v(" "),l("p",[e._v("3、"),l("strong",[e._v("fields(Object, [callback])")])]),e._v(" "),l("blockquote",[l("p",[e._v("指定获取那些信息 (id, dataset, rect, size, scrollOffset , properties=[获取的常规属性名称(注:id class style 除外)], computedStyle=[获取的样式名称])")])])])}],!1,null,null,null);t.default=r.exports}}]);
--------------------------------------------------------------------------------
/src/zh/vue/Vue组件.md:
--------------------------------------------------------------------------------
1 | # Vue组件
2 | #### 1、组件是什么?
3 | 1. 是vue.js最强大的功能之一
4 | 2. 可以扩展html元素,封装可重用的代码
5 | #### 2、注册全局组件
6 |
7 | ```
8 | Vue.component('组件名称',引入的.vue文件)
9 |
10 | main.js
11 | import heads from 'src/heads';
12 | Vue.component('heads',heads)
13 | // 然后在页面直接引用heads标签就可以了
14 |
15 | ```
16 | #### 3、prop
17 | - 是父组件用来传递数据的一个自定义属性
18 | - 父组件的数据需要通过props把数据传给子组件,子组件需要显示地用props选项声明'prop''
19 |
20 | ```
21 | 参数:
22 | props:{
23 | Child:{
24 | type:Number,
25 | required:true // 默认值是false
26 | default:{
27 | return{
28 | msg:'hello!'
29 | }
30 | }
31 | }
32 | }
33 | ```
34 | #### 4、自定义事件
35 | - $on(even) 监听事件
36 | - $emit(even) 触发事件
37 | #### 5、组件通讯
38 |
39 | ```
40 | 1、同级目录
41 | 全局: window.Eventhub = new Vue();
42 | 发送:methods:{
43 | send(){
44 | EventHub.$emit('HowAre',this.val)
45 | }
46 | }
47 | 接收:mounted(){
48 | EventHub.$on('HowAre',res=>{
49 | this.val = res
50 | })
51 | }
52 | 2、父级向子级通讯(利用props)
53 | 父级:
54 | data(){
55 | return{
56 | tit:'加油加油 !'
57 | }
58 | }
59 | 子级:
60 | props:['tit'] 接收
61 |
62 | 3、子级向父级通讯(利用回调函数)
63 | 子级:
64 | this.$emit('solgan',this.val)
65 | 父级:
66 |
67 | methods:{
68 | onSolgan(val){
69 | this.solgan = val
70 | }
71 | }
72 |
73 | ```
74 |
75 | #### 4、组件components/component
76 |
77 | 1. 局部(components)
78 |
79 | ```
80 | 多个
81 | components:{
82 | 组件名称:{
83 | name:
84 | data(){
85 |
86 | },
87 | methods:{
88 |
89 | },
90 | beforeCreate:{
91 |
92 | }
93 | template = html字符串
94 | // template有且只有一个子元素
95 |
96 |
97 | }
98 | }
99 | ```
100 | 2. 全局(component)
101 |
102 | ```
103 | Vue.component('组件名称',引入的.vue文件)
104 | ```
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/lib/markdown/index.js:
--------------------------------------------------------------------------------
1 | const highlight = require('./highlight')
2 | const highlightLines = require('./highlightLines')
3 | const preWrapper = require('./preWrapper')
4 | const lineNumbers = require('./lineNumbers')
5 | const component = require('./component')
6 | const hoistScriptStyle = require('./hoist')
7 | const convertRouterLink = require('./link')
8 | const containers = require('./containers')
9 | const snippet = require('./snippet')
10 | const emoji = require('markdown-it-emoji')
11 | const anchor = require('markdown-it-anchor')
12 | const toc = require('markdown-it-table-of-contents')
13 | const _slugify = require('./slugify')
14 | const { parseHeaders } = require('../util/parseHeaders')
15 |
16 | module.exports = ({ markdown = {}} = {}) => {
17 | // allow user config slugify
18 | const slugify = markdown.slugify || _slugify
19 |
20 | const md = require('markdown-it')({
21 | html: true,
22 | highlight
23 | })
24 | // custom plugins
25 | .use(component)
26 | .use(highlightLines)
27 | .use(preWrapper)
28 | .use(snippet)
29 | .use(convertRouterLink, Object.assign({
30 | target: '_blank',
31 | rel: 'noopener noreferrer'
32 | }, markdown.externalLinks))
33 | .use(hoistScriptStyle)
34 | .use(containers)
35 |
36 | // 3rd party plugins
37 | .use(emoji)
38 | .use(anchor, Object.assign({
39 | slugify,
40 | permalink: true,
41 | permalinkBefore: true,
42 | permalinkSymbol: '#'
43 | }, markdown.anchor))
44 | .use(toc, Object.assign({
45 | slugify,
46 | includeLevel: [2, 3],
47 | format: parseHeaders
48 | }, markdown.toc))
49 |
50 | // apply user config
51 | if (markdown.config) {
52 | markdown.config(md)
53 | }
54 |
55 | if (markdown.lineNumbers) {
56 | md.use(lineNumbers)
57 | }
58 |
59 | module.exports.dataReturnable(md)
60 |
61 | // expose slugify
62 | md.slugify = slugify
63 |
64 | return md
65 | }
66 |
67 | module.exports.dataReturnable = function dataReturnable (md) {
68 | // override render to allow custom plugins return data
69 | const render = md.render
70 | md.render = (...args) => {
71 | md.__data = {}
72 | const html = render.call(md, ...args)
73 | return {
74 | html,
75 | data: md.__data
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/lib/util/parseHeaders.js:
--------------------------------------------------------------------------------
1 | // Since VuePress needs to extract the header from the markdown source
2 | // file and display it in the sidebar or title (#238), this file simply
3 | // removes some unnecessary elements to make header displays well at
4 | // sidebar or title.
5 | //
6 | // But header's parsing in the markdown content is done by the markdown
7 | // loader based on markdown-it. markdown-it parser will will always keep
8 | // HTML in headers, so in VuePress, after being parsed by the markdiwn
9 | // loader, the raw HTML in headers will finally be parsed by Vue-loader.
10 | // so that we can write HTML/Vue in the header. One exception is the HTML
11 | // wrapped by (markdown token: '`') tag.
12 |
13 | const { compose } = require('./shared')
14 |
15 | const parseEmojis = str => {
16 | const emojiData = require('markdown-it-emoji/lib/data/full.json')
17 | return String(str).replace(/:(.+?):/g, (placeholder, key) => emojiData[key] || placeholder)
18 | }
19 |
20 | const unescapeHtml = html => String(html)
21 | .replace(/"/g, '"')
22 | .replace(/'/g, '\'')
23 | .replace(/:/g, ':')
24 | .replace(/</g, '<')
25 | .replace(/>/g, '>')
26 |
27 | const removeMarkdownTokens = str => String(str)
28 | .replace(/\[(.*)\]\(.*\)/, '$1') // []()
29 | .replace(/(`|\*{1,3}|_)(.*?[^\\])\1/g, '$2') // `{t}` | *{t}* | **{t}** | ***{t}*** | _{t}_
30 | .replace(/(\\)(\*|_|`)/g, '$2') // remove escape char '\'
31 |
32 | const trim = str => str.trim()
33 |
34 | // This method remove the raw HTML but reserve the HTML wrapped by ``.
35 | // e.g.
36 | // Input: " b", Output: "b"
37 | // Input: "`` b", Output: "`` b"
38 | exports.removeNonCodeWrappedHTML = (str) => {
39 | return String(str).replace(/(^|[^><`])<.*>([^><`]|$)/g, '$1$2')
40 | }
41 |
42 | // Unescape html, parse emojis and remove some md tokens.
43 | exports.parseHeaders = compose(
44 | unescapeHtml,
45 | parseEmojis,
46 | removeMarkdownTokens,
47 | trim
48 | )
49 |
50 | // Also clean the html that isn't wrapped by code.
51 | // Because we want to support using VUE components in headers.
52 | // e.g. https://vuepress.vuejs.org/guide/using-vue.html#badge
53 | exports.deeplyParseHeaders = compose(
54 | exports.removeNonCodeWrappedHTML,
55 | exports.parseHeaders,
56 | )
57 |
--------------------------------------------------------------------------------
/lib/webpack/createClientConfig.js:
--------------------------------------------------------------------------------
1 | module.exports = function createClientConfig (options, cliOptions) {
2 | const path = require('path')
3 | const WebpackBar = require('webpackbar')
4 | const createBaseConfig = require('./createBaseConfig')
5 |
6 | const config = createBaseConfig(options, cliOptions)
7 |
8 | config
9 | .entry('app')
10 | .add(path.resolve(__dirname, '../app/clientEntry.js'))
11 |
12 | config.node
13 | .merge({
14 | // prevent webpack from injecting useless setImmediate polyfill because Vue
15 | // source contains it (although only uses it if it's native).
16 | setImmediate: false,
17 | global: false,
18 | process: false,
19 | // prevent webpack from injecting mocks to Node native modules
20 | // that does not make sense for the client
21 | dgram: 'empty',
22 | fs: 'empty',
23 | net: 'empty',
24 | tls: 'empty',
25 | child_process: 'empty'
26 | })
27 |
28 | // generate client manifest only during build
29 | if (process.env.NODE_ENV === 'production') {
30 | // This is a temp build of vue-server-renderer/client-plugin.
31 | // TODO Switch back to original after problems are resolved.
32 | // Fixes two things:
33 | // 1. Include CSS in preload files
34 | // 2. filter out useless styles.xxxxx.js chunk from mini-css-extract-plugin
35 | // https://github.com/webpack-contrib/mini-css-extract-plugin/issues/85
36 | config
37 | .plugin('ssr-client')
38 | .use(require('./ClientPlugin'), [{
39 | filename: 'manifest/client.json'
40 | }])
41 |
42 | config
43 | .plugin('optimize-css')
44 | .use(require('optimize-css-assets-webpack-plugin'), [{
45 | canPrint: false,
46 | cssProcessorOptions: {
47 | safe: true,
48 | autoprefixer: { disable: true },
49 | mergeLonghand: false
50 | }
51 | }])
52 | }
53 |
54 | if (!cliOptions.debug) {
55 | config
56 | .plugin('bar')
57 | .use(WebpackBar, [{
58 | name: 'Client',
59 | color: '#41b883',
60 | compiledIn: false
61 | }])
62 | }
63 |
64 | if (options.siteConfig.chainWebpack) {
65 | options.siteConfig.chainWebpack(config, false /* isServer */)
66 | }
67 |
68 | return config
69 | }
70 |
--------------------------------------------------------------------------------
/lib/util/index.js:
--------------------------------------------------------------------------------
1 | const { deeplyParseHeaders } = require('./parseHeaders')
2 |
3 | exports.normalizeHeadTag = function (tag) {
4 | if (typeof tag === 'string') {
5 | tag = [tag]
6 | }
7 | const tagName = tag[0]
8 | return {
9 | tagName,
10 | attributes: tag[1] || {},
11 | innerHTML: tag[2] || '',
12 | closeTag: !(tagName === 'meta' || tagName === 'link')
13 | }
14 | }
15 |
16 | exports.applyUserWebpackConfig = function (userConfig, config, isServer) {
17 | const merge = require('webpack-merge')
18 | if (typeof userConfig === 'object') {
19 | return merge(config, userConfig)
20 | }
21 | if (typeof userConfig === 'function') {
22 | const res = userConfig(config, isServer)
23 | if (res && typeof res === 'object') {
24 | return merge(config, res)
25 | }
26 | }
27 | return config
28 | }
29 |
30 | exports.inferTitle = function (frontmatter) {
31 | if (frontmatter.data.home) {
32 | return 'Home'
33 | }
34 | if (frontmatter.data.title) {
35 | return deeplyParseHeaders(frontmatter.data.title)
36 | }
37 | const match = frontmatter.content.trim().match(/^#+\s+(.*)/)
38 | if (match) {
39 | return deeplyParseHeaders(match[1])
40 | }
41 | }
42 |
43 | exports.parseFrontmatter = function (content) {
44 | const matter = require('gray-matter')
45 | const toml = require('toml')
46 |
47 | return matter(content, {
48 | excerpt_separator: '',
49 | engines: {
50 | toml: toml.parse.bind(toml),
51 | excerpt: false
52 | }
53 | })
54 | }
55 |
56 | const LRU = require('lru-cache')
57 | const cache = LRU({ max: 1000 })
58 |
59 | exports.extractHeaders = function (content, include = [], md) {
60 | const key = content + include.join(',')
61 | const hit = cache.get(key)
62 | if (hit) {
63 | return hit
64 | }
65 |
66 | const tokens = md.parse(content, {})
67 |
68 | const res = []
69 | tokens.forEach((t, i) => {
70 | if (t.type === 'heading_open' && include.includes(t.tag)) {
71 | const title = tokens[i + 1].content
72 | const slug = t.attrs.find(([name]) => name === 'id')[1]
73 | res.push({
74 | level: parseInt(t.tag.slice(1), 10),
75 | title: deeplyParseHeaders(title),
76 | slug: slug || md.slugify(title)
77 | })
78 | }
79 | })
80 |
81 | cache.set(key, res)
82 | return res
83 | }
84 |
--------------------------------------------------------------------------------
/lib/prepare/codegen.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const { fileToComponentName, resolveComponents } = require('./util')
3 |
4 | exports.genRoutesFile = async function ({
5 | siteData: { pages },
6 | sourceDir,
7 | pageFiles
8 | }) {
9 | function genRoute ({ path: pagePath, key: componentName }, index) {
10 | const file = pageFiles[index]
11 | const filePath = path.resolve(sourceDir, file)
12 | let code = `
13 | {
14 | name: ${JSON.stringify(componentName)},
15 | path: ${JSON.stringify(pagePath)},
16 | component: ThemeLayout,
17 | beforeEnter: (to, from, next) => {
18 | import(${JSON.stringify(filePath)}).then(comp => {
19 | Vue.component(${JSON.stringify(componentName)}, comp.default)
20 | next()
21 | })
22 | }
23 | }`
24 |
25 | const dncodedPath = decodeURIComponent(pagePath)
26 | if (dncodedPath !== pagePath) {
27 | code += `,
28 | {
29 | path: ${JSON.stringify(dncodedPath)},
30 | redirect: ${JSON.stringify(pagePath)}
31 | }`
32 | }
33 |
34 | if (/\/$/.test(pagePath)) {
35 | code += `,
36 | {
37 | path: ${JSON.stringify(pagePath + 'index.html')},
38 | redirect: ${JSON.stringify(pagePath)}
39 | }`
40 | }
41 |
42 | return code
43 | }
44 |
45 | const notFoundRoute = `,
46 | {
47 | path: '*',
48 | component: ThemeNotFound
49 | }`
50 |
51 | return (
52 | `import ThemeLayout from '@themeLayout'\n` +
53 | `import ThemeNotFound from '@themeNotFound'\n` +
54 | `import { injectMixins } from '@app/util'\n` +
55 | `import rootMixins from '@app/root-mixins'\n\n` +
56 | `injectMixins(ThemeLayout, rootMixins)\n` +
57 | `injectMixins(ThemeNotFound, rootMixins)\n\n` +
58 | `export const routes = [${pages.map(genRoute).join(',')}${notFoundRoute}\n]`
59 | )
60 | }
61 |
62 | exports.genComponentRegistrationFile = async function ({ sourceDir }) {
63 | function genImport (file) {
64 | const name = fileToComponentName(file)
65 | const baseDir = path.resolve(sourceDir, '.vuepress/components')
66 | const absolutePath = path.resolve(baseDir, file)
67 | const code = `Vue.component(${JSON.stringify(name)}, () => import(${JSON.stringify(absolutePath)}))`
68 | return code
69 | }
70 |
71 | const components = (await resolveComponents(sourceDir)) || []
72 | return `import Vue from 'vue'\n` + components.map(genImport).join('\n')
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/docs/assets/js/43.8b6224f6.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[43],{171:function(t,a,e){"use strict";e.r(a);var r=e(0),s=Object(r.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"content"},[e("h1",{attrs:{id:"组件通信"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#组件通信","aria-hidden":"true"}},[t._v("#")]),t._v(" 组件通信")]),t._v(" "),e("h5",{attrs:{id:"emit"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#emit","aria-hidden":"true"}},[t._v("#")]),t._v(" $emit")]),t._v(" "),e("blockquote",[e("p",[t._v("子向父通信")])]),t._v(" "),e("h5",{attrs:{id:"broadcast"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#broadcast","aria-hidden":"true"}},[t._v("#")]),t._v(" $broadcast")]),t._v(" "),e("blockquote",[e("p",[t._v("父向子通信")])]),t._v(" "),e("h5",{attrs:{id:"父子通信:父组件传递数据给子组件"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#父子通信:父组件传递数据给子组件","aria-hidden":"true"}},[t._v("#")]),t._v(" 父子通信:父组件传递数据给子组件")]),t._v(" "),e("p",[e("strong",[t._v("1、通过props传值")])]),t._v(" "),e("ol",[e("li",[t._v("如果需要传递动态属性值需要添加.sync修饰符")]),t._v(" "),e("li",[t._v("如果要在子组件中修改父组件数据需要在接受的时候添加 twoWay: true")]),t._v(" "),e("li",[t._v("如果需要数据双向绑定需要(.sync 和 twoWay 同时)")])]),t._v(" "),e("p",[e("strong",[t._v("2、实用$broadcast将数据广播到所有子组件中")])]),t._v(" "),e("h5",{attrs:{id:"子父通信:子组件传递数据给父组件"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#子父通信:子组件传递数据给父组件","aria-hidden":"true"}},[t._v("#")]),t._v(" 子父通信:子组件传递数据给父组件")]),t._v(" "),e("ol",[e("li",[t._v("在父组件中events中定义事件,在子组件$emit触发 (推荐)")]),t._v(" "),e("li",[t._v("在父组件methods中添加方法,在子组件中this.$invoke('../', '函数名称')")]),t._v(" "),e("li",[t._v("在子组件中通过this.$parent获取到父组件实例,调用父组件回调函数给父组件发送数据")])]),t._v(" "),e("h5",{attrs:{id:"同级:a、b两个同级组件的数据发送"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#同级:a、b两个同级组件的数据发送","aria-hidden":"true"}},[t._v("#")]),t._v(" 同级:A、B两个同级组件的数据发送")]),t._v(" "),e("ol",[e("li",[t._v("在A组件中通过this.$invoke('../B', '函数名称') 调用B组件中的回调函数传递数据")]),t._v(" "),e("li",[t._v("将数据发送到父组件,父组件在传递给另一个子组件(代理方式)")]),t._v(" "),e("li",[t._v("自己封装一个发布订阅器(eventbus)")])]),t._v(" "),e("h5",{attrs:{id:"跨级:"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#跨级:","aria-hidden":"true"}},[t._v("#")]),t._v(" 跨级:")]),t._v(" "),e("ol",[e("li",[t._v("逐层传递")]),t._v(" "),e("li",[t._v("this.$invoke('组件路径', '函数名称')")])]),t._v(" "),e("p",[e("strong",[t._v("使用redux可以做所有的数据管理")])])])}],!1,null,null,null);a.default=s.exports}}]);
--------------------------------------------------------------------------------
/src/guide/README.md:
--------------------------------------------------------------------------------
1 | # 介绍
2 |
3 |
4 |
5 | VuePress 由两部分组成:一个以 Vue 驱动的主题系统的简约静态网站生成工具,和一个为编写技术文档而优化的默认主题。它是为了支持 Vue 子项目的文档需求而创建的。
6 |
7 | 由 VuePress 生成的每个页面,都具有相应的预渲染静态 HTML,它们能提供出色的加载性能,并且对 SEO 友好。然而,页面加载之后,Vue 就会将这些静态内容,接管为完整的单页面应用程序(SPA)。当用户在浏览站点时,可以按需加载其他页面。
8 |
9 | ## 运行原理(how it works)
10 |
11 | VuePress 网站实际上是由 [Vue](http://vuejs.org/), [Vue Router](https://github.com/vuejs/vue-router) 和 [webpack](http://webpack.js.org/) 驱动的单页面应用程序。如果你以前使用过 Vue,那么在编写或开发自定义主题时(甚至可以使用 Vue DevTools 来调试你的自定义主题!),你会融入到熟悉的开发体验中!
12 |
13 | 在构建过程中,我们会创建应用程序的服务器渲染版本,并且实际上是通过访问每个路由,来渲染相应的 HTML。这种方式受到 [Nuxt](https://nuxtjs.org/) 的 `nuxt generate` 命令以及 [Gatsby](https://www.gatsbyjs.org/) 等其他项目的启发。
14 |
15 | 每个 markdown 文件都使用 [markdown-it](https://github.com/markdown-it/markdown-it) 编译为 HTML,然后作为 Vue 组件的模板进行处理。这允许你直接在 markdown 文件中使用 Vue,在需要嵌入动态内容时,这种使用方式非常有用。
16 |
17 | ## 特性(features)
18 |
19 | - [内置 markdown 扩展](./markdown.md),针对技术文档进行了优化
20 | - [能够利用内嵌在 markdown 文件中的 Vue 代码](./using-vue.md)
21 | - [以 Vue 驱动的自定义主题系统](./custom-themes.md)
22 | - [自动生成 Service Worker](../config/README.md#serviceworker)
23 | - [Google Analytics 集成](../config/README.md#ga)
24 | - [基于 Git 的"最近更新"](../default-theme-config/README.md#最近更新)
25 | - [多语言支持](./i18n.md)
26 | - 一个默认主题包括:
27 | - 响应式布局
28 | - [可选的主页](../default-theme-config/README.md#主页-homepage)
29 | - [简单、开箱即用、基于标题的搜索功能](../default-theme-config/README.md#内置搜索-built-in-search)
30 | - [Algolia 搜索](../default-theme-config/README.md#algolia-search)
31 | - 可定制的[导航栏](../default-theme-config/README.md#导航栏-navbar)和[侧边栏](../default-theme-config/README.md#侧边栏-sidebar)
32 | - [自动生成的 GitHub 链接和页面编辑链接](../default-theme-config/README.md#git-仓库和编辑链接)
33 |
34 | ## 待实现特性(todo)
35 |
36 | VuePress 的开发仍在进行中。有几件目前不支持,但计划做的功能:
37 |
38 | - 插件支持
39 | - 博客支持
40 |
41 | 欢迎贡献!
42 |
43 | ## 为什么不使用下面这些工具?
44 |
45 | ### Nuxt
46 |
47 | VuePress 能做的事情,Nuxt 也同样能够实现,但是,它是为构建应用程序而设计的。而 VuePress 专注于以内容为中心的静态网站,并且为开箱即用的技术文档,提供量身定制的功能。
48 |
49 | ### Docsify / Docute
50 |
51 | 二者都是伟大的项目,也都是以 Vue 驱动。但它们完全是运行时驱动(runtime-driven)的项目,因此不适合 SEO 优化。如果你不关心 SEO 优化,也不想因为安装依赖而扰乱心神,这些仍然是不错的选择。
52 |
53 | ### Hexo
54 |
55 | Hexo 一直在为 Vue 文档提供服务 - 事实上,离我们的主站完全迁移到 VuePress,可能还要经过一段时间。其中最大的问题是,它的主题系统是非常静态和基于字符串的 - 我们确实需要利用 Vue 来实现布局和交互。此外,无法对 Hexo 的 markdown 渲染,进行极其灵活的配置。
56 |
57 | ### GitBook
58 |
59 | 我们大部分的子项目文档中已经使用了 GitBook。GitBook 的主要问题是有大量文件时,它的开发重载性能简直令人无法容忍。它的默认主题也只有一个非常有限的导航结构,并且主题系统也不是基于 Vue 的。GitBook 背后的团队也更注重将其打造为一个商业产品,而不是开源工具。
60 |
--------------------------------------------------------------------------------
/src/zh/vue/vuex.md:
--------------------------------------------------------------------------------
1 | # Vuex
2 | ##### 1、什么是vuex?
3 | - 每一个 Vuex 应用的核心就是 store(仓库)。“store”基本上就是一个容器,它包含着你的应用中大部分的状态 (state)。
4 |
5 | ##### 2、初始化vuex
6 | (1)下载vuex
7 |
8 | ```
9 | cnpm i vuex -D
10 | ```
11 |
12 |
13 | (2)建一个store文件夹(store/index.js)
14 |
15 | ```
16 | // 初始化vuex
17 |
18 | import Vue from 'vue';
19 | import Vuex from 'vuex';
20 |
21 | // 引入module
22 | import app from './module/app';
23 |
24 | Vue.use(Vuex);
25 |
26 | // 生成一个vuex实例
27 | export default new Vuex.Store({
28 | modules: {
29 | app
30 | }
31 | })
32 | ```
33 | (3)在store文件夹里建一个module文件夹用来存放数据(store/module/app.js)
34 |
35 | ```
36 | // 存放数据的地方
37 | const state = {
38 | num: 100
39 | }
40 |
41 | // 派生数据(很少用)
42 | const getters = {
43 | doubleNum(state){
44 | return state.num*2
45 | }
46 | }
47 |
48 | // 同步改变
49 | const mutations = {
50 | changeNum(state, payload){
51 | state.num = payload;
52 | }
53 | }
54 |
55 | // 异步改变
56 | const actions = {
57 |
58 |
59 |
60 | changeNumAsync({commit}, payload){
61 | commit('changeNum', payload)
62 | }
63 | }
64 |
65 | export default {
66 | // 命名空间
67 | namespaced: true, // 配合module使用
68 | state,
69 | actions,
70 | getters,
71 | mutations
72 | }
73 | ```
74 | (4)在main.js里面引入store
75 |
76 | ```
77 | import Vue from 'vue'
78 | import App from './App.vue'
79 |
80 | import store from './store'
81 |
82 | new Vue({
83 | el: '#app',
84 | store,
85 | render: h => h(App)
86 | })
87 |
88 | ```
89 | (5)在页面中使用
90 |
91 | ```
92 |
93 |
94 |
95 | {{num}}
96 |
97 |
98 |
99 |
122 |
123 | ```
124 |
125 |
--------------------------------------------------------------------------------
/src/zh/guide/i18n.md:
--------------------------------------------------------------------------------
1 | # 多语言支持
2 |
3 | ## 站点多语言配置
4 |
5 | 要启用 VuePress 的多语言支持,首先需要使用如下的文件结构:
6 |
7 | ```
8 | study
9 | ├─ README.md
10 | ├─ foo.md
11 | ├─ nested
12 | │ └─ README.md
13 | └─ zh
14 | ├─ README.md
15 | ├─ foo.md
16 | └─ nested
17 | └─ README.md
18 | ```
19 |
20 | 然后,在 `.vuepress/config.js` 中提供 `locales` 选项:
21 |
22 | ``` js
23 | module.exports = {
24 | locales: {
25 | // 键名是该语言所属的子路径
26 | // 作为特例,默认语言可以使用 '/' 作为其路径。
27 | '/': {
28 | lang: 'en-US', // 将会被设置为 的 lang 属性
29 | title: 'VuePress',
30 | description: 'Vue-powered Static Site Generator'
31 | },
32 | '/zh/': {
33 | lang: 'zh-CN',
34 | title: 'VuePress',
35 | description: 'Vue 驱动的静态网站生成器'
36 | }
37 | }
38 | }
39 | ```
40 |
41 | 如果一个语言没有声明 `title` 或者 `description`,VuePress 将会尝试使用配置顶层的对应值。如果每个语言都声明了 `title` 和 `description`,则顶层的这两个值可以被省略。
42 |
43 | ## 默认主题多语言配置
44 |
45 | 默认主题也内置了多语言支持,可以通过 `themeConfig.locales` 来配置。该选项接受同样的 `{ path: config }` 格式的值。每个语言除了可以配置一些站点中用到的文字之外,还可以拥有自己的 [导航栏](../default-theme-config/README.md#导航栏) 和 [侧边栏](../default-theme-config/README.md#侧边栏) 配置:
46 |
47 | ``` js
48 | module.exports = {
49 | locales: { /* ... */ },
50 | themeConfig: {
51 | locales: {
52 | '/': {
53 | selectText: 'Languages',
54 | label: 'English',
55 | editLinkText: 'Edit this page on GitHub',
56 | serviceWorker: {
57 | updatePopup: {
58 | message: "New content is available.",
59 | buttonText: "Refresh"
60 | }
61 | },
62 | algolia: {},
63 | nav: [
64 | { text: 'Nested', link: '/nested/' }
65 | ],
66 | sidebar: {
67 | '/': [/* ... */],
68 | '/nested/': [/* ... */]
69 | }
70 | },
71 | '/zh/': {
72 | // 多语言下拉菜单的标题
73 | selectText: '选择语言',
74 | // 该语言在下拉菜单中的标签
75 | label: '简体中文',
76 | // 编辑链接文字
77 | editLinkText: '在 GitHub 上编辑此页',
78 | // Service Worker 的配置
79 | serviceWorker: {
80 | updatePopup: {
81 | message: "发现新内容可用.",
82 | buttonText: "刷新"
83 | }
84 | },
85 | // 当前 locale 的 algolia studyearch 选项
86 | algolia: {},
87 | nav: [
88 | { text: '嵌套', link: '/zh/nested/' }
89 | ],
90 | sidebar: {
91 | '/zh/': [/* ... */],
92 | '/zh/nested/': [/* ... */]
93 | }
94 | }
95 | }
96 | }
97 | }
98 | ```
99 |
--------------------------------------------------------------------------------
/docs/assets/js/39.84216f96.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[39],{175:function(v,_,e){"use strict";e.r(_);var t=e(0),i=Object(t.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var v=this,_=v.$createElement,e=v._self._c||_;return e("div",{staticClass:"content"},[e("h1",{attrs:{id:"面试必备知识点"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#面试必备知识点","aria-hidden":"true"}},[v._v("#")]),v._v(" 面试必备知识点")]),v._v(" "),e("h2",{attrs:{id:"css"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#css","aria-hidden":"true"}},[v._v("#")]),v._v(" CSS")]),v._v(" "),e("ul",[e("li",[v._v("盒模型")]),v._v(" "),e("li",[v._v("CSS的单位和应用场景及Rem的设置")]),v._v(" "),e("li",[v._v("定位,回流与重绘")]),v._v(" "),e("li",[v._v("IFC、BFC与清除浮动")]),v._v(" "),e("li",[v._v("兼容处理")])]),v._v(" "),e("h2",{attrs:{id:"原生js"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#原生js","aria-hidden":"true"}},[v._v("#")]),v._v(" 原生JS")]),v._v(" "),e("ul",[e("li",[v._v("变量提升配合作用域链")]),v._v(" "),e("li",[v._v("原型链")]),v._v(" "),e("li",[v._v("继承")]),v._v(" "),e("li",[v._v("闭包")]),v._v(" "),e("li",[v._v("new与面向对象")]),v._v(" "),e("li",[v._v("event loop")]),v._v(" "),e("li",[v._v("event delegation/proxy")]),v._v(" "),e("li",[v._v("节流与防动")]),v._v(" "),e("li",[v._v("Promise原理")]),v._v(" "),e("li",[v._v("SPA路由原理")]),v._v(" "),e("li",[v._v("本地存储localStorage、sessionStorage与cookie之间的区别")])]),v._v(" "),e("h2",{attrs:{id:"vue"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#vue","aria-hidden":"true"}},[v._v("#")]),v._v(" Vue")]),v._v(" "),e("ul",[e("li",[v._v("深入Vue的响应原理?")]),v._v(" "),e("li",[v._v("Vue多版本之间的区别(运行时依赖,运行时编译)?")]),v._v(" "),e("li",[v._v("Vue中computed、watch与methods的区别")]),v._v(" "),e("li",[v._v("多种指令与自定义指令")]),v._v(" "),e("li",[v._v("路由传参与导航守卫")]),v._v(" "),e("li",[v._v("Element UI && so on")])]),v._v(" "),e("h2",{attrs:{id:"react"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#react","aria-hidden":"true"}},[v._v("#")]),v._v(" React")]),v._v(" "),e("ul",[e("li",[v._v("什么是MVVM?React与Vue的区别与联系?")]),v._v(" "),e("li",[v._v("JSX语法、Virtual DOM与DOM Diff算法?")]),v._v(" "),e("li",[v._v("详细介绍生命周期(三个阶段,生命周期的触发顺序)?")]),v._v(" "),e("li",[v._v("合成事件与改变this指向的三种方式及之间的区别?")]),v._v(" "),e("li",[v._v("样式绑定与CSS Modules")]),v._v(" "),e("li",[v._v("多种组件创建方式及其区别?什么是受控组件?")]),v._v(" "),e("li",[v._v("高阶组件与装饰器")]),v._v(" "),e("li",[v._v("组件通信的多种方式及其之间的区别")]),v._v(" "),e("li",[v._v("React Router及其简单实现")]),v._v(" "),e("li",[v._v("Redux数据流向及三个中间件(redux-logger、redux-thunk、redux-saga)")]),v._v(" "),e("li",[v._v("Ant Design && so on")])])])}],!1,null,null,null);_.default=i.exports}}]);
--------------------------------------------------------------------------------
/lib/app/clientEntry.js:
--------------------------------------------------------------------------------
1 | /* global BASE_URL, GA_ID, ga, SW_ENABLED, VUEPRESS_VERSION, LAST_COMMIT_HASH*/
2 |
3 | import { createApp } from './app'
4 | import SWUpdateEvent from './SWUpdateEvent'
5 | import { register } from 'register-service-worker'
6 |
7 | const { app, router } = createApp()
8 |
9 | window.__VUEPRESS_VERSION__ = {
10 | version: VUEPRESS_VERSION,
11 | hash: LAST_COMMIT_HASH
12 | }
13 |
14 | // Google analytics integration
15 | if (process.env.NODE_ENV === 'production' && GA_ID) {
16 | (function (i, s, o, g, r, a, m) {
17 | i['GoogleAnalyticsObject'] = r
18 | i[r] = i[r] || function () {
19 | (i[r].q = i[r].q || []).push(arguments)
20 | }
21 | i[r].l = 1 * new Date()
22 | a = s.createElement(o)
23 | m = s.getElementsByTagName(o)[0]
24 | a.async = 1
25 | a.src = g
26 | m.parentNode.insertBefore(a, m)
27 | })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga')
28 |
29 | ga('create', GA_ID, 'auto')
30 | ga('send', 'pageview')
31 |
32 | router.afterEach(function (to) {
33 | ga('set', 'page', to.fullPath)
34 | ga('send', 'pageview')
35 | })
36 | }
37 |
38 | router.onReady(() => {
39 | app.$mount('#app')
40 |
41 | // Register service worker
42 | if (process.env.NODE_ENV === 'production' &&
43 | SW_ENABLED &&
44 | window.location.protocol === 'https:') {
45 | register(`${BASE_URL}service-worker.js`, {
46 | ready () {
47 | console.log('[vuepress:sw] Service worker is active.')
48 | app.$refs.layout.$emit('sw-ready')
49 | },
50 | cached (registration) {
51 | console.log('[vuepress:sw] Content has been cached for offline use.')
52 | app.$refs.layout.$emit('sw-cached', new SWUpdateEvent(registration))
53 | },
54 | updated (registration) {
55 | console.log('[vuepress:sw] Content updated.')
56 | app.$refs.layout.$emit('sw-updated', new SWUpdateEvent(registration))
57 | },
58 | offline () {
59 | console.log('[vuepress:sw] No internet connection found. App is running in offline mode.')
60 | app.$refs.layout.$emit('sw-offline')
61 | },
62 | error (err) {
63 | console.error('[vuepress:sw] Error during service worker registration:', err)
64 | app.$refs.layout.$emit('sw-error', err)
65 | if (GA_ID) {
66 | ga('send', 'exception', {
67 | exDescription: err.message,
68 | exFatal: false
69 | })
70 | }
71 | }
72 | })
73 | }
74 | })
75 |
--------------------------------------------------------------------------------
/lib/prepare/util.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const spawn = require('cross-spawn')
3 | const fs = require('fs-extra')
4 | const globby = require('globby')
5 |
6 | const tempPath = path.resolve(__dirname, '../app/.temp')
7 | fs.ensureDirSync(tempPath)
8 |
9 | const tempCache = new Map()
10 | exports.writeTemp = async function (file, content) {
11 | // cache write to avoid hitting the dist if it didn't change
12 | const cached = tempCache.get(file)
13 | if (cached !== content) {
14 | await fs.writeFile(path.join(tempPath, file), content)
15 | tempCache.set(file, content)
16 | }
17 | }
18 |
19 | exports.writeEnhanceTemp = async function (destName, srcPath) {
20 | await exports.writeTemp(
21 | destName,
22 | fs.existsSync(srcPath)
23 | ? `export { default } from ${JSON.stringify(srcPath)}`
24 | : `export default function () {}`
25 | )
26 | }
27 |
28 | const indexRE = /(^|.*\/)(index|readme)\.md$/i
29 | const extRE = /\.(vue|md)$/
30 |
31 | exports.fileToPath = function (file) {
32 | if (exports.isIndexFile(file)) {
33 | // README.md -> /
34 | // foo/README.md -> /foo/
35 | return file.replace(indexRE, '/$1')
36 | } else {
37 | // foo.md -> /foo.html
38 | // foo/bar.md -> /foo/bar.html
39 | return `/${file.replace(extRE, '').replace(/\\/g, '/')}.html`
40 | }
41 | }
42 |
43 | exports.fileToComponentName = function (file) {
44 | let normalizedName = file
45 | .replace(/\/|\\/g, '-')
46 | .replace(extRE, '')
47 | if (exports.isIndexFile(file)) {
48 | normalizedName = normalizedName.replace(/readme$/i, 'index')
49 | }
50 | const pagePrefix = /\.md$/.test(file) ? `page-` : ``
51 | return `${pagePrefix}${normalizedName}`
52 | }
53 |
54 | exports.isIndexFile = function (file) {
55 | return indexRE.test(file)
56 | }
57 |
58 | exports.resolveComponents = async function (sourceDir) {
59 | const componentDir = path.resolve(sourceDir, '.vuepress/components')
60 | if (!fs.existsSync(componentDir)) {
61 | return
62 | }
63 | return exports.sort(await globby(['**/*.vue'], { cwd: componentDir }))
64 | }
65 |
66 | exports.sort = function (arr) {
67 | return arr.sort((a, b) => {
68 | if (a < b) return -1
69 | if (a > b) return 1
70 | return 0
71 | })
72 | }
73 |
74 | exports.encodePath = function (userpath) {
75 | return userpath.split('/').map(item => encodeURIComponent(item)).join('/')
76 | }
77 |
78 | exports.getGitLastUpdatedTimeStamp = function (filepath) {
79 | return parseInt(spawn.sync('git', ['log', '-1', '--format=%ct', filepath]).stdout.toString('utf-8')) * 1000
80 | }
81 |
--------------------------------------------------------------------------------
/docs/assets/js/56.627b1a35.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[56],{158:function(e,t,a){"use strict";a.r(t);var r=a(0),s=Object(r.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"content"},[a("h1",{attrs:{id:"redux中间件"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#redux中间件","aria-hidden":"true"}},[e._v("#")]),e._v(" Redux中间件")]),e._v(" "),a("h5",{attrs:{id:"_1、applymiddleware"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#_1、applymiddleware","aria-hidden":"true"}},[e._v("#")]),e._v(" 1、applyMiddleware")]),e._v(" "),a("ul",[a("li",[e._v("方便调试,实时触发,线下使用")])]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v("import {createStore,applyMiddleware} from 'redux';\nimport reducers from './reducers';\nimport Logger from 'redux-logger';\n\nexport default createStore(reducers, applyMiddleware(Logger))\n")])])]),a("h5",{attrs:{id:"_2、redux-thunk"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#_2、redux-thunk","aria-hidden":"true"}},[e._v("#")]),e._v(" 2、redux-thunk")]),e._v(" "),a("ul",[a("li",[e._v("目的:异步解决方案")]),e._v(" "),a("li",[e._v("支持action的写法有对象变为函数")]),e._v(" "),a("li",[e._v("可以发送多个dispatch")]),e._v(" "),a("li",[e._v("改变action")]),e._v(" "),a("li",[e._v("同时会帮我们注入两个参数dispatch和getState")]),e._v(" "),a("li",[e._v("在异步操作完成之后再触发dispatch操作")])]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v('dispatch((dispatch, getState)=>{\n // getState可以获取全局的state\n dispatch({\n type:"START"\n })\n fetch(\'/data.json\')\n .then(res=>res.json())\n .then(success=>{\n if(success){\n dispatch({\n type:"FETCH_LIST",\n payLoad:success.arr\n })\n }else{\n dispatch({\n type:"FETCH_TAIL"\n })\n }\n })\n})\n')])])]),a("h5",{attrs:{id:"_3、redux-saga"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#_3、redux-saga","aria-hidden":"true"}},[e._v("#")]),e._v(" 3、redux-saga")]),e._v(" "),a("ul",[a("li",[e._v("拦截请求")]),e._v(" "),a("li",[e._v("解决异步")]),e._v(" "),a("li",[e._v("不会改变action")]),e._v(" "),a("li",[e._v("take 拦截")]),e._v(" "),a("li",[e._v("takeEvery 每次都拦截")])]),e._v(" "),a("h5",{attrs:{id:"_4、redux-thunk"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#_4、redux-thunk","aria-hidden":"true"}},[e._v("#")]),e._v(" 4、redux-thunk")]),e._v(" "),a("ul",[a("li",[e._v("改写action")])])])}],!1,null,null,null);t.default=s.exports}}]);
--------------------------------------------------------------------------------
/docs/assets/js/36.529eaf6d.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[36],{178:function(t,a,e){"use strict";e.r(a);var r=e(0),s=Object(r.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"content"},[e("h1",{attrs:{id:"今日头条小程序的接口"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#今日头条小程序的接口","aria-hidden":"true"}},[t._v("#")]),t._v(" 今日头条小程序的接口")]),t._v(" "),e("h2",{attrs:{id:"首页"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#首页","aria-hidden":"true"}},[t._v("#")]),t._v(" 首页")]),t._v(" "),e("h3",{attrs:{id:"获取顶部tab"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#获取顶部tab","aria-hidden":"true"}},[t._v("#")]),t._v(" 获取顶部tab")]),t._v(" "),e("ul",[e("li",[t._v("url: get https://m.toutiao.com/pwa/api/wxapp/settings")])]),t._v(" "),e("h3",{attrs:{id:"分类tab切换"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#分类tab切换","aria-hidden":"true"}},[t._v("#")]),t._v(" 分类tab切换")]),t._v(" "),e("ul",[e("li",[t._v("url: get https://lf.snssdk.com/api/news/feed/v66/?language=zh-Hans-CN&count=20&category=[tab分类]&aid=1162&min_behot_time=[分页behot_time]&device_id=6650307045722932750")])]),t._v(" "),e("h3",{attrs:{id:"获取资讯详情"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#获取资讯详情","aria-hidden":"true"}},[t._v("#")]),t._v(" 获取资讯详情")]),t._v(" "),e("ul",[e("li",[t._v("url: get https://m.toutiao.com/pwa/api/wxapp/info/[资讯的id]/")])]),t._v(" "),e("h3",{attrs:{id:"获取资讯评论"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#获取资讯评论","aria-hidden":"true"}},[t._v("#")]),t._v(" 获取资讯评论")]),t._v(" "),e("ul",[e("li",[t._v("url: get https://ib.snssdk.com/article/v1/tab_comments/?group_id=[资讯的id]&&tab_index=0&count=[分页数量]&offset=[分页偏移]")])]),t._v(" "),e("h3",{attrs:{id:"生成小程序码"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#生成小程序码","aria-hidden":"true"}},[t._v("#")]),t._v(" 生成小程序码")]),t._v(" "),e("ul",[e("li",[t._v("url: get https://m.toutiao.com/pwa/api/wxapp/wxacode/?id=[资讯的id]&group_id=[资讯的id]&channel=0&page=pages/detail/detail")])]),t._v(" "),e("h3",{attrs:{id:"搜索提示接口"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#搜索提示接口","aria-hidden":"true"}},[t._v("#")]),t._v(" 搜索提示接口")]),t._v(" "),e("ul",[e("li",[t._v("url: get https://lf.snssdk.com/2/article/search_sug/?keyword=[搜索关键字]&device_id=6650307045722932750")])]),t._v(" "),e("h3",{attrs:{id:"搜索结果接口"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#搜索结果接口","aria-hidden":"true"}},[t._v("#")]),t._v(" 搜索结果接口")]),t._v(" "),e("ul",[e("li",[t._v("url: get https://lf.snssdk.com/api/2/wap/search_content/?keyword=[搜索关键字]&count=10&format=json&offset=[分页偏移]&search_text=[搜索提示结果]&device_id=6650307045722932750")])])])}],!1,null,null,null);a.default=s.exports}}]);
--------------------------------------------------------------------------------
/docs/assets/js/42.219bb0ac.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[42],{172:function(a,e,t){"use strict";t.r(e);var s=t(0),r=Object(s.a)({},function(){this.$createElement;this._self._c;return this._m(0)},[function(){var a=this,e=a.$createElement,t=a._self._c||e;return t("div",{staticClass:"content"},[t("h1",{attrs:{id:"wxs"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#wxs","aria-hidden":"true"}},[a._v("#")]),a._v(" WXS")]),a._v(" "),t("h5",{attrs:{id:"wxs是什么?"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#wxs是什么?","aria-hidden":"true"}},[a._v("#")]),a._v(" wxs是什么?")]),a._v(" "),t("blockquote",[t("p",[a._v("WXS(WeiXin Script)是小程序的一套脚本语言,结合 WXML,可以构建出页面的结构。")])]),a._v(" "),t("h5",{attrs:{id:"注意"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#注意","aria-hidden":"true"}},[a._v("#")]),a._v(" 注意")]),a._v(" "),t("ol",[t("li",[a._v("wxs 不依赖于运行时的基础库版本,可以在所有版本的小程序中运行。")]),a._v(" "),t("li",[a._v("wxs 与 javascript 是不同的语言,有自己的语法,并不和 javascript 一致。")]),a._v(" "),t("li",[a._v("wxs 的运行环境和其他 javascript 代码是隔离的,wxs 中不能调用其他 javascript文件中定义的函数,也不能调用小程序提供的API。")]),a._v(" "),t("li",[a._v("wxs 函数不能作为组件的事件回调。")]),a._v(" "),t("li",[a._v("由于运行环境的差异,在 iOS 设备上小程序内的 wxs 会比 javascript 代码快 2 ~ 20 倍。在 android 设备上二者运行效率无差异。")])]),a._v(" "),t("h5",{attrs:{id:"页面渲染"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#页面渲染","aria-hidden":"true"}},[a._v("#")]),a._v(" 页面渲染")]),a._v(" "),t("div",{staticClass:"language- extra-class"},[t("pre",{pre:!0,attrs:{class:"language-text"}},[t("code",[a._v('\x3c!--wxml--\x3e\n\n var msg = "hello world";\n\n module.exports.message = msg;\n \n\n {{m1.message}} \n\n\n页面输出\nhello world\n')])])]),t("h5",{attrs:{id:"数据处理"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#数据处理","aria-hidden":"true"}},[a._v("#")]),a._v(" 数据处理")]),a._v(" "),t("div",{staticClass:"language- extra-class"},[t("pre",{pre:!0,attrs:{class:"language-text"}},[t("code",[a._v("// page.js\nPage({\n data: {\n array: [1, 2, 3, 4, 5, 1, 2, 3, 4]\n }\n})\n")])])]),t("div",{staticClass:"language- extra-class"},[t("pre",{pre:!0,attrs:{class:"language-text"}},[t("code",[a._v('\x3c!--wxml--\x3e\n\x3c!-- 下面的 getMax 函数,接受一个数组,且返回数组中最大的元素的值 --\x3e\n\nvar getMax = function(array) {\n var max = undefined;\n for (var i = 0; i < array.length; ++i) {\n max = max === undefined ? \n array[i] : \n (max >= array[i] ? max : array[i]);\n }\n return max;\n}\n\nmodule.exports.getMax = getMax;\n \n\n\x3c!-- 调用 wxs 里面的 getMax 函数,参数为 page.js 里面的 array --\x3e\n {{m1.getMax(array)}} \n')])])]),t("p",[a._v("页面输出")]),a._v(" "),t("div",{staticClass:"language- extra-class"},[t("pre",{pre:!0,attrs:{class:"language-text"}},[t("code",[a._v("5\n")])])])])}],!1,null,null,null);e.default=r.exports}}]);
--------------------------------------------------------------------------------