Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
640d806a
U
uni-app
项目概览
DCloud
/
uni-app
大约 1 个月 前同步成功
通知
702
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
640d806a
编写于
5月 28, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore(ssr): add vuex demo
上级
6fcaca39
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
83 addition
and
41 deletion
+83
-41
packages/playground/ssr/package.json
packages/playground/ssr/package.json
+2
-1
packages/playground/ssr/src/main.js
packages/playground/ssr/src/main.js
+4
-0
packages/playground/ssr/src/pages/index/index.vue
packages/playground/ssr/src/pages/index/index.vue
+29
-2
packages/playground/ssr/yarn.lock
packages/playground/ssr/yarn.lock
+12
-0
packages/uni-app/dist/uni-app.cjs.js
packages/uni-app/dist/uni-app.cjs.js
+1
-1
packages/uni-app/dist/uni-app.es.js
packages/uni-app/dist/uni-app.es.js
+1
-1
yarn.lock
yarn.lock
+34
-36
未找到文件。
packages/playground/ssr/package.json
浏览文件 @
640d806a
...
...
@@ -17,7 +17,8 @@
"@dcloudio/uni-i18n"
:
"../../uni-i18n"
,
"@dcloudio/uni-shared"
:
"../../uni-shared"
,
"@vue/shared"
:
"^3.1.0-beta.5"
,
"vue"
:
"^3.1.0-beta.5"
"vue"
:
"^3.1.0-beta.5"
,
"vuex"
:
"^4.0.1"
},
"devDependencies"
:
{
"@dcloudio/uni-cli-shared"
:
"../../uni-cli-shared"
,
...
...
packages/playground/ssr/src/main.js
浏览文件 @
640d806a
import
{
createSSRApp
}
from
'
vue
'
import
App
from
'
./App.vue
'
import
createStore
from
'
./store
'
export
function
createApp
()
{
const
store
=
createStore
()
const
app
=
createSSRApp
(
App
)
app
.
use
(
store
)
// `trace` 是组件的继承关系追踪
app
.
config
.
warnHandler
=
function
(
msg
)
{
const
ssrLogElem
=
document
.
getElementById
(
'
ssr-log
'
)
...
...
@@ -9,5 +12,6 @@ export function createApp() {
}
return
{
app
,
store
,
}
}
packages/playground/ssr/src/pages/index/index.vue
浏览文件 @
640d806a
<
template
>
<text
v-if=
"item"
>
{{
item
.
title
}}
</text>
<text
v-else
>
...
</text>
<ssr-cover-image
/>
<ssr-cover-view
/>
<ssr-icon
/>
...
...
@@ -14,14 +16,39 @@
</
template
>
<
script
>
const
id
=
1
;
export
default
{
data
()
{
return
{
title
:
'
Hello
'
,
}
},
onLoad
()
{
},
methods
:
{},
computed
:
{
// display the item from store state.
item
()
{
return
this
.
$store
.
state
.
items
[
id
]
}
},
// Server-side only
// This will be called by the server renderer automatically
serverPrefetch
()
{
// return the Promise from the action
// so that the component waits before rendering
return
this
.
fetchItem
()
},
// Client-side only
mounted
()
{
// If we didn't already do it on the server
// we fetch the item (will first show the loading text)
if
(
!
this
.
item
)
{
this
.
fetchItem
()
}
},
methods
:
{
fetchItem
()
{
return
this
.
$store
.
dispatch
(
'
fetchItem
'
,
id
)
}
}
}
</
script
>
...
...
packages/playground/ssr/yarn.lock
浏览文件 @
640d806a
...
...
@@ -254,6 +254,11 @@
"@vue/compiler-dom" "3.1.0-beta.5"
"@vue/shared" "3.1.0-beta.5"
"@vue/devtools-api@^6.0.0-beta.11":
version "6.0.0-beta.11"
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.0.0-beta.11.tgz#4fb4161ee41ba75f3f5198d4bfd80e4ffb7f2462"
integrity sha512-vpw61AkW9U8c2upjJCljHq9eh1KkD4FJ7DYbRzIETpj9WAw2VESudJZosAk4M+7npBo1Zu1jNQY03HUMVO/czQ==
"@vue/reactivity@3.1.0-beta.5":
version "3.1.0-beta.5"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.1.0-beta.5.tgz#c5b279a3d95ab35fa92489f2abc94f613bc6734c"
...
...
@@ -2453,6 +2458,13 @@ vue@^3.1.0-beta.5:
"@vue/runtime-dom" "3.1.0-beta.5"
"@vue/shared" "3.1.0-beta.5"
vuex@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-4.0.1.tgz#e83c541d6f31173969efabb2c5d1c465b682887e"
integrity sha512-MddakQTAnImDkK1YhEESowKSU5KcjqHH3L1ScPx1lj6NzDDX0FuRBZqJoME5O7/nvj9puudDf6xnWU2w/cqI7g==
dependencies:
"@vue/devtools-api" "^6.0.0-beta.11"
which@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
...
...
packages/uni-app/dist/uni-app.cjs.js
浏览文件 @
640d806a
...
...
@@ -117,7 +117,7 @@ const onError = /*#__PURE__*/ createHook(ON_ERROR);
const
onThemeChange
=
/*#__PURE__*/
createHook
(
ON_THEME_CHANGE
);
const
onPageNotFound
=
/*#__PURE__*/
createHook
(
ON_PAGE_NOT_FOUND
);
const
onUnhandledRejection
=
/*#__PURE__*/
createHook
(
ON_UNHANDLE_REJECTION
);
// export const onLoad = /*#__PURE__*/ createHook(ON_LOAD)
const
onReady
=
/*#__PURE__*/
createHook
(
ON_READY
);
const
onUnload
=
/*#__PURE__*/
createHook
(
ON_UNLOAD
);
const
onResize
=
/*#__PURE__*/
createHook
(
ON_RESIZE
);
...
...
packages/uni-app/dist/uni-app.es.js
浏览文件 @
640d806a
...
...
@@ -82,7 +82,7 @@ const onError = /*#__PURE__*/ createHook(ON_ERROR);
const
onThemeChange
=
/*#__PURE__*/
createHook
(
ON_THEME_CHANGE
);
const
onPageNotFound
=
/*#__PURE__*/
createHook
(
ON_PAGE_NOT_FOUND
);
const
onUnhandledRejection
=
/*#__PURE__*/
createHook
(
ON_UNHANDLE_REJECTION
);
// export const onLoad = /*#__PURE__*/ createHook(ON_LOAD)
const
onReady
=
/*#__PURE__*/
createHook
(
ON_READY
);
const
onUnload
=
/*#__PURE__*/
createHook
(
ON_UNLOAD
);
const
onResize
=
/*#__PURE__*/
createHook
(
ON_RESIZE
);
...
...
yarn.lock
浏览文件 @
640d806a
...
...
@@ -1396,10 +1396,10 @@
"@octokit/types" "^6.0.3"
universal-user-agent "^6.0.0"
"@octokit/openapi-types@^7.2.
0
":
version "7.2.
1
"
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-7.2.
1.tgz#3ba1abe8906863edd403e185bc12e2bf79b3e240
"
integrity sha512-
IHQJpLciwzwDvciLxiFj3IEV5VYn7lSVcj5cu0jbTwMfK4IG6/g8SPrVp3Le1VRzIiYSRcBzm1dA7vgWelYP3Q
==
"@octokit/openapi-types@^7.2.
3
":
version "7.2.
3
"
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-7.2.
3.tgz#a7105796db9b85d25d3feba9a1785a124c7803e4
"
integrity sha512-
V1ycxkR19jqbIl3evf2RQiMRBvTNRi+Iy9h20G5OP5dPfEF6GJ1DPlUeiZRxo2HJxRr+UA4i0H1nn4btBDPFrw
==
"@octokit/plugin-enterprise-rest@^6.0.1":
version "6.0.1"
...
...
@@ -1418,12 +1418,12 @@
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz#70a62be213e1edc04bb8897ee48c311482f9700d"
integrity sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==
"@octokit/plugin-rest-endpoint-methods@5.
0.1
":
version "5.
0.1
"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.
0.1.tgz#631b8d4edc6798b03489911252a25f2a4e58c594
"
integrity sha512-
vvWbPtPqLyIzJ7A4IPdTl+8IeuKAwMJ4LjvmqWOOdfSuqWQYZXq2CEd0hsnkidff2YfKlguzujHs/reBdAx8Sg
==
"@octokit/plugin-rest-endpoint-methods@5.
3.0
":
version "5.
3.0
"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.
3.0.tgz#bcc8b4432ee24b30d6a4934c9e2baacda46a5aaf
"
integrity sha512-
+4NAJ9WzPN5gW6W1H1tblw/DesTD6PaWuU5+/x3Pa7nyK6qjR6cn4jwkJtzxVPTgtzryOFLX+5vs7MROFswp5Q
==
dependencies:
"@octokit/types" "^6.1
3.1
"
"@octokit/types" "^6.1
6.0
"
deprecation "^2.3.1"
"@octokit/request-error@^2.0.0", "@octokit/request-error@^2.0.5":
...
...
@@ -1448,21 +1448,21 @@
universal-user-agent "^6.0.0"
"@octokit/rest@^18.1.0":
version "18.5.
3
"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.5.
3.tgz#6a2e6006a87ebbc34079c419258dd29ec9ff659d
"
integrity sha512-
KPAsUCr1DOdLVbZJgGNuE/QVLWEaVBpFQwDAz/2Cnya6uW2wJ/P5RVGk0itx7yyN1aGa8uXm2pri4umEqG1JBA
==
version "18.5.
4
"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.5.
4.tgz#cb4ace20915a6d18b5afe945f8076ea7b044dd77
"
integrity sha512-
n3Q5ikar6dFvGmSrzRwIrPvSAkwibQr5Ti0h722T/YuylsPYahRTmVEU1Vg+XIg8MHgHBTKmwBzz0IwpbseOtQ
==
dependencies:
"@octokit/core" "^3.2.3"
"@octokit/plugin-paginate-rest" "^2.6.2"
"@octokit/plugin-request-log" "^1.0.2"
"@octokit/plugin-rest-endpoint-methods" "5.
0.1
"
"@octokit/plugin-rest-endpoint-methods" "5.
3.0
"
"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.1
3.1
", "@octokit/types@^6.7.1":
version "6.16.
0
"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.16.
0.tgz#15f71e391ca74e91a21b70e3a1b033c89625dca
4"
integrity sha512-
EktqSNq8EKXE82a7Vw33ozOEhFXIRik+rZHJTHAgVZRm/p2K5r5ecn5fVpRkLCm3CAVFwchRvt3yvtmfbt2LCQ
==
"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.1
6.0
", "@octokit/types@^6.7.1":
version "6.16.
2
"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.16.
2.tgz#62242e0565a3eb99ca2fd376283fe78b4ea057b
4"
integrity sha512-
wWPSynU4oLy3i4KGyk+J1BLwRKyoeW2TwRHgwbDz17WtVFzSK2GOErGliruIx8c+MaYtHSYTx36DSmLNoNbtgA
==
dependencies:
"@octokit/openapi-types" "^7.2.
0
"
"@octokit/openapi-types" "^7.2.
3
"
"@rollup/plugin-alias@^3.1.1":
version "3.1.2"
...
...
@@ -3479,9 +3479,9 @@ detect-indent@^5.0.0:
integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50=
detect-indent@^6.0.0:
version "6.
0
.0"
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.
0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd
"
integrity sha512-
oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4Yn
A==
version "6.
1
.0"
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.
1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6
"
integrity sha512-
reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYt
A==
detect-newline@^3.0.0:
version "3.1.0"
...
...
@@ -3564,9 +3564,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.723:
version "1.3.74
0
"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.74
0.tgz#e38b7d2b848f632191b643e6dabca51be2162922
"
integrity sha512-
Mi2m55JrX2BFbNZGKYR+2ItcGnR4O5HhrvgoRRyZQlaMGQULqDhoGkLWHzJoshSzi7k1PUofxcDbNhlFrDZNhg
==
version "1.3.74
1
"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.74
1.tgz#dc1024b19b31e27fb2c8c0a1f120cb05fc6ca695
"
integrity sha512-
4i3T0cwnHo1O4Mnp9JniEco8bZiXoqbm3PhW5hv7uu8YLg35iajYrRnNyKFaN8/8SSTskU2hYqVTeYVPceSpUA
==
elliptic@^6.5.3:
version "6.5.4"
...
...
@@ -3652,9 +3652,9 @@ error-ex@^1.2.0, error-ex@^1.3.1:
is-arrayish "^0.2.1"
es-abstract@^1.18.0-next.2:
version "1.18.
2
"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.
2.tgz#6eb518b640262e8ddcbd48e0bc8549f82efd48a7
"
integrity sha512-
byRiNIQXE6HWNySaU6JohoNXzYgbBjztwFnBLUTiJmWXjaU9bSq3urQLUlNLQ292tc+gc07zYZXNZjaOoAX3s
w==
version "1.18.
3
"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.
3.tgz#25c4c3380a27aa203c44b2b685bba94da31b63e0
"
integrity sha512-
nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8v
w==
dependencies:
call-bind "^1.0.2"
es-to-primitive "^1.2.1"
...
...
@@ -4096,7 +4096,7 @@ fb-watchman@^2.0.0:
dependencies:
bser "2.1.1"
figures@^3.0.0
, figures@^3.2.0
:
figures@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==
...
...
@@ -6069,14 +6069,12 @@ lint-staged@^10.5.3:
stringify-object "^3.3.0"
listr2@^3.2.2:
version "3.
8.4
"
resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.
8.4.tgz#58ef278a430509d072c568d96d87a4357813638b
"
integrity sha512-
DX+iKRcxaGbBjoLJBQlGceZoqdhV6Z54wpsvIVoVKNJ/lEXK8KhGhLaZnIGKRQmDmtJOtyNSnnKFUS1qn+jqs
w==
version "3.
9.0
"
resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.
9.0.tgz#27f23c91ba4fdf513b0682bf604bc6b0ab36b6c1
"
integrity sha512-
+JxQt7Vi4WEWgJsxmOEX9lDbCumrb3mrEYIeE1VI7I4lf2rXE4v9pq3RMVNp+a9s6mCgc/IsF0ppHsLrx2BEA
w==
dependencies:
cli-truncate "^2.1.0"
colorette "^1.2.2"
figures "^3.2.0"
indent-string "^4.0.0"
log-update "^4.0.0"
p-map "^4.0.0"
rxjs "^6.6.7"
...
...
@@ -8167,9 +8165,9 @@ rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.8.2:
estree-walker "^0.6.1"
rollup@^2.35.1, rollup@^2.38.5:
version "2.50.
1
"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.50.
1.tgz#5d52d5c65ade19164d56efec98f16a461c6df38e
"
integrity sha512-
3MQhSdGpms4xjYrtR3WNHMT+VrWWM4oqUxUC770MmLo1FWFR2pr/OL81HSPC/ifmiu0uMFk0qPGLmjkSMRIES
w==
version "2.50.
2
"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.50.
2.tgz#640c500c68c698f62efb01857e0ff06fcd18181f
"
integrity sha512-
Ra5JkxSiZPZZFnvE68KWtlrLnZGg5LNaV1n1esq4ch69P7ReeoRVlrTuL/k+L/GJfcowA5An0BEhEq2Hfzwl6
w==
optionalDependencies:
fsevents "~2.3.1"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录