Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
7a5248f4
提交
7a5248f4
authored
8月 18, 2022
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 新增全局 Message 工具方法、横竖屏实例等
上级
821b7b8f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
59 行增加
和
16 行删除
+59
-16
autoImport.ts
build/vite/autoImport.ts
+1
-0
pnpm-lock.yaml
pnpm-lock.yaml
+0
-0
App.vue
src/App.vue
+4
-8
fui-app.ts
src/common/fui-app.ts
+10
-1
message.ts
src/common/message.ts
+23
-0
fui-footer.vue
src/components/firstui/fui-footer/fui-footer.vue
+4
-5
index.vue
src/pages/index/index.vue
+16
-2
auto-imports.d.ts
types/auto-imports.d.ts
+1
-0
没有找到文件。
build/vite/autoImport.ts
浏览文件 @
7a5248f4
...
...
@@ -18,6 +18,7 @@ export function configAutoImportPlugin(): Plugin {
'@/config/app'
:
[
'$app'
],
'@/api/services'
:
[
'defs'
],
'@/api/services/mods'
:
[
'API'
],
'@/commom/message'
:
[
'Message'
],
},
],
})
...
...
pnpm-lock.yaml
浏览文件 @
7a5248f4
差异被折叠。
点击展开。
src/App.vue
浏览文件 @
7a5248f4
<
script
setup
lang=
"ts"
>
import
{
Message
}
from
'@/common/message'
onLaunch
(()
=>
{
console
.
log
(
'App Launch'
)
})
...
...
@@ -12,17 +14,11 @@
})
onError
((
err
)
=>
{
uni
.
showToast
({
title
:
'App Error: '
+
err
,
icon
:
'none'
,
})
Message
.
toast
(
'App Error: '
+
err
)
})
onUnhandledRejection
((
err
)
=>
{
uni
.
showToast
({
title
:
'App UnhandledRejection: '
+
err
,
icon
:
'none'
,
})
Message
.
toast
(
'App UnhandledRejection: '
+
err
)
})
</
script
>
...
...
src/common/fui-app.ts
浏览文件 @
7a5248f4
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 156 16 26 019 5,身份证尾号:503 75T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
const
fui
=
{
toast
:
function
(
text
:
string
)
{
text
&&
if
(
text
)
{
// #ifndef APP-PLUS
uni
.
showToast
({
title
:
text
,
icon
:
'none'
,
duration
:
2000
,
})
// #endif
// #ifdef APP-PLUS
plus
.
nativeUI
.
toast
(
text
,
{
duration
:
'short'
,
})
// #endif
}
},
modal
:
function
(
title
:
string
,
...
...
src/common/message.ts
0 → 100644
浏览文件 @
7a5248f4
export
const
Message
=
{
/**
* 消息轻提示
* @param text 消息内容
*/
toast
:
function
(
text
:
string
)
{
if
(
text
)
{
// #ifndef APP-PLUS
uni
.
showToast
({
title
:
text
,
icon
:
'none'
,
duration
:
2000
,
})
// #endif
// #ifdef APP-PLUS
plus
.
nativeUI
.
toast
(
text
,
{
duration
:
'short'
,
})
// #endif
}
},
}
src/components/firstui/fui-footer/fui-footer.vue
浏览文件 @
7a5248f4
...
...
@@ -120,11 +120,11 @@
left
:
0
;
right
:
0
;
/* #ifndef APP-NVUE */
left
:
constant
(
safe-area-inset-left
);
/*
left: constant(safe-area-inset-left);
left: env(safe-area-inset-left);
right: constant(safe-area-inset-right);
right
:
env
(
safe-area-inset-right
)
/* #endif */
right: env(safe-area-inset-right)
*/
/* #endif */
}
.fui-footer__link
{
...
...
@@ -212,4 +212,4 @@
}
/* #endif */
</
style
>
\ No newline at end of file
</
style
>
src/pages/index/index.vue
浏览文件 @
7a5248f4
<
script
setup
lang=
"ts"
>
import
{
Message
}
from
'@/common/message'
import
dayjs
from
'dayjs'
const
year
=
ref
(
dayjs
().
year
())
...
...
@@ -6,14 +7,27 @@
// TODO: 测试接口
API
.
example
.
hello
.
request
().
then
((
body
)
=>
{
console
.
log
(
body
)
title
.
value
=
body
Message
.
toast
(
body
)
console
.
log
(
body
)
})
const
change
=
()
=>
{
const
orientation
=
plus
.
navigator
.
getOrientation
()
Message
.
toast
(
'Orientation: '
+
orientation
)
if
(
orientation
===
0
)
{
plus
.
screen
.
lockOrientation
(
'landscape-primary'
)
}
else
if
(
orientation
===
90
)
{
plus
.
screen
.
lockOrientation
(
'portrait-primary'
)
}
}
</
script
>
<
template
>
<view
class=
"content"
>
<fui-avatar
src=
"/static/logo.png"
radius=
"14"
/>
<fui-avatar
src=
"/static/logo.png"
radius=
"14"
@
click=
"change"
/>
<view
class=
"info"
>
<text
class=
"title"
>
{{
title
}}
</text>
<text
class=
"title"
>
{{
$t
(
'app.hello'
)
}}
</text>
...
...
types/auto-imports.d.ts
浏览文件 @
7a5248f4
...
...
@@ -18,6 +18,7 @@ declare global {
const
isReadonly
:
typeof
import
(
'vue'
)[
'isReadonly'
]
const
isRef
:
typeof
import
(
'vue'
)[
'isRef'
]
const
markRaw
:
typeof
import
(
'vue'
)[
'markRaw'
]
const
Message
:
typeof
import
(
'@/commom/message'
)[
'Message'
]
const
nextTick
:
typeof
import
(
'vue'
)[
'nextTick'
]
const
onActivated
:
typeof
import
(
'vue'
)[
'onActivated'
]
const
onAddToFavorites
:
typeof
import
(
'@dcloudio/uni-app'
)[
'onAddToFavorites'
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论