Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
848d02e9
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
716
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,发现更多精彩内容 >>
提交
848d02e9
编写于
8月 05, 2021
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: uni-id indexes & ssr
上级
9550fb80
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
38 deletion
+45
-38
docs/collocation/_sidebar.md
docs/collocation/_sidebar.md
+1
-0
docs/collocation/ssr.md
docs/collocation/ssr.md
+38
-38
docs/uniCloud/uni-id.md
docs/uniCloud/uni-id.md
+6
-0
未找到文件。
docs/collocation/_sidebar.md
浏览文件 @
848d02e9
...
...
@@ -13,6 +13,7 @@
*
[
生命周期
](
collocation/frame/lifecycle.md
)
*
[
页面
](
collocation/frame/window.md
)
*
[
页面通讯
](
collocation/frame/communication.md
)
*
[
SSR服务端渲染
](
collocation/ssr.md
)
*
[
国际化
](
collocation/i18n.md
)
*
自动化测试
*
[
快速开始
](
collocation/auto/quick-start.md
)
...
...
docs/ssr.md
→
docs/
collocation/
ssr.md
浏览文件 @
848d02e9
...
...
@@ -126,33 +126,33 @@ export function createApp() {
3.
在页面或组件中使用
```
html
<template>
<text
v-if=
"item"
>
{{ item.title }}
</text>
<text
v-else
>
...
</text>
</template>
<script>
const
id
=
1
;
// 模拟ID
export
default
{
computed
:
{
item
()
{
return
this
.
$store
.
state
.
items
[
id
]
}
},
serverPrefetch
()
{
// 服务端预取数据的生命周期
return
this
.
fetchItem
()
},
mounted
()
{
// 仅客户端执行的生命周期
if
(
!
this
.
item
)
{
// 判断服务端是否已正常获取,若未获取,重新调用加载数据
this
.
fetchItem
()
}
},
methods
:
{
fetchItem
()
{
return
this
.
$store
.
dispatch
(
'
fetchItem
'
,
id
)
}
}
}
<template>
<text
v-if=
"item"
>
{{ item.title }}
</text>
<text
v-else
>
...
</text>
</template>
<script>
const
id
=
1
;
// 模拟ID
export
default
{
computed
:
{
item
()
{
return
this
.
$store
.
state
.
items
[
id
]
}
},
serverPrefetch
()
{
// 服务端预取数据的生命周期
return
this
.
fetchItem
()
},
mounted
()
{
// 仅客户端执行的生命周期
if
(
!
this
.
item
)
{
// 判断服务端是否已正常获取,若未获取,重新调用加载数据
this
.
fetchItem
()
}
},
methods
:
{
fetchItem
()
{
return
this
.
$store
.
dispatch
(
'
fetchItem
'
,
id
)
}
}
}
</script>
```
...
...
@@ -162,20 +162,20 @@ export default {
*
开通
[
uniCloud
](
https://unicloud.dcloud.net.cn
)
以及
[
前端网页托管
](
https://uniapp.dcloud.net.cn/uniCloud/hosting
)
*
配置
`vite.config.js`
中的
`base`
为
`前端网页托管`
地址
```
js
import
{
defineConfig
}
from
'
vite
'
import
uni
from
'
@dcloudio/vite-plugin-uni
'
// https://vitejs.dev/config/
export
default
defineConfig
({
base
:
'
https://static-xxxx.bspapp.com/
'
,
// uniCloud 前端网页托管资源地址(主要是应用编译后的js,图片等静态资源,可以配置为二级目录)
plugins
:
[
uni
(),
],
import
{
defineConfig
}
from
'
vite
'
import
uni
from
'
@dcloudio/vite-plugin-uni
'
// https://vitejs.dev/config/
export
default
defineConfig
({
base
:
'
https://static-xxxx.bspapp.com/
'
,
// uniCloud 前端网页托管资源地址(主要是应用编译后的js,图片等静态资源,可以配置为二级目录)
plugins
:
[
uni
(),
],
})
```
*
编译:
> cli工程:`npm run build:h5:ssr`或通过`HBuilderX`的`发行菜单->网站 PC-Web或手机H5`、勾选`ssr`
> cli工程:`npm run build:h5:ssr`或通过`HBuilderX
3.1.16及以上版本
`的`发行菜单->网站 PC-Web或手机H5`、勾选`ssr`
!
[
以ssr模式发行
](
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/d7574ced-e253-4b73-8187-86d6a8811364.jpg
)
...
...
docs/uniCloud/uni-id.md
浏览文件 @
848d02e9
...
...
@@ -2925,6 +2925,12 @@ const res = await uniID.forbidAppLogin({
}
```
### 用户表索引@uni-id-users-indexes
目前opendb内提供的uni-id-users表包含完整的索引,数据库在索引量多且频繁更新的情况下可能会出现写入缓慢的情况,因此推荐开发者在使用uni-id-users表时可以适当删除部分没有用到的索引。
例:项目内只使用了微信登录,不使用其他登录方式,可以只保留
`wx_unionid、wx_openid.mp-weixin、wx_openid.app-plus`
这些账号相关的索引,删除其他账号的索引
## 验证码表
表名:
`opendb-verify-codes`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录