Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzj-java
uni-app
提交
9b2812b4
U
uni-app
项目概览
wzj-java
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9b2812b4
编写于
5月 07, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uts): refactor
上级
a4a44874
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
131 addition
and
32 deletion
+131
-32
packages/uni-app-plus/bin/uts.js
packages/uni-app-plus/bin/uts.js
+0
-3
packages/uni-app-plus/package.json
packages/uni-app-plus/package.json
+1
-6
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+37
-8
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+53
-9
packages/uts/bin/uts.js
packages/uts/bin/uts.js
+2
-0
packages/uts/dist/index.d.ts
packages/uts/dist/index.d.ts
+15
-1
packages/uts/package.json
packages/uts/package.json
+4
-0
packages/uts/src/cli.ts
packages/uts/src/cli.ts
+2
-3
packages/uts/src/index.ts
packages/uts/src/index.ts
+15
-1
packages/uts/tsconfig.json
packages/uts/tsconfig.json
+2
-1
未找到文件。
packages/uni-app-plus/bin/uts.js
已删除
100755 → 0
浏览文件 @
a4a44874
#!/usr/bin/env node
/* eslint-disable no-restricted-globals */
require
(
'
@dcloudio/uts/dist/cli/index.js
'
)
packages/uni-app-plus/package.json
浏览文件 @
9b2812b4
...
...
@@ -2,11 +2,7 @@
"name"
:
"@dcloudio/uni-app-plus"
,
"version"
:
"3.0.0-alpha-3040820220424001"
,
"description"
:
"@dcloudio/uni-app-plus"
,
"bin"
:
{
"uts"
:
"bin/uts.js"
},
"files"
:
[
"bin"
,
"dist"
,
"lib"
,
"style"
...
...
@@ -44,7 +40,6 @@
},
"dependencies"
:
{
"@dcloudio/uni-app-vite"
:
"3.0.0-alpha-3040820220424001"
,
"@dcloudio/uni-app-vue"
:
"3.0.0-alpha-3040820220424001"
,
"@dcloudio/uts"
:
"3.0.0-alpha-3040820220424001"
"@dcloudio/uni-app-vue"
:
"3.0.0-alpha-3040820220424001"
}
}
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
9b2812b4
...
...
@@ -10248,20 +10248,22 @@ function createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList) {
const
selected
=
selectedIndex
===
index2
;
const
textColor
=
selected
?
selectedColor
:
color
;
const
iconPath
=
(
selected
?
item
.
selectedIconPath
||
item
.
iconPath
:
item
.
iconPath
)
||
""
;
const
iconfontText
=
item
.
iconfont
?
selected
?
item
.
iconfont
.
selectedText
||
item
.
iconfont
.
text
:
item
.
iconfont
.
text
:
void
0
;
const
iconfontColor
=
item
.
iconfont
?
selected
?
item
.
iconfont
.
selectedColor
||
item
.
iconfont
.
color
:
item
.
iconfont
.
color
:
void
0
;
if
(
!
__UNI_FEATURE_TABBAR_MIDBUTTON__
)
{
return
createTabBarItemTsx
(
textColor
,
iconPath
,
item
,
tabBar2
,
index2
,
onSwitchTab
);
return
createTabBarItemTsx
(
textColor
,
iconPath
,
i
confontText
,
iconfontColor
,
i
tem
,
tabBar2
,
index2
,
onSwitchTab
);
}
return
isMidButton
(
item
)
?
createTabBarMidButtonTsx
(
textColor
,
iconPath
,
i
tem
,
tabBar2
,
index2
,
onSwitchTab
)
:
createTabBarItemTsx
(
textColor
,
iconPath
,
item
,
tabBar2
,
index2
,
onSwitchTab
);
return
isMidButton
(
item
)
?
createTabBarMidButtonTsx
(
textColor
,
iconPath
,
i
confontText
,
iconfontColor
,
item
,
tabBar2
,
index2
,
onSwitchTab
)
:
createTabBarItemTsx
(
textColor
,
iconPath
,
iconfontText
,
iconfontColor
,
item
,
tabBar2
,
index2
,
onSwitchTab
);
});
}
function
createTabBarItemTsx
(
color
,
iconPath
,
tabBarItem
,
tabBar2
,
index2
,
onSwitchTab
)
{
function
createTabBarItemTsx
(
color
,
iconPath
,
iconfontText
,
iconfontColor
,
tabBarItem
,
tabBar2
,
index2
,
onSwitchTab
)
{
return
vue
.
createVNode
(
"
div
"
,
{
"
key
"
:
index2
,
"
class
"
:
"
uni-tabbar__item
"
,
"
onClick
"
:
onSwitchTab
(
tabBarItem
,
index2
)
},
[
createTabBarItemBdTsx
(
color
,
iconPath
||
""
,
tabBarItem
,
tabBar2
)],
8
,
[
"
onClick
"
]);
},
[
createTabBarItemBdTsx
(
color
,
iconPath
||
""
,
iconfontText
,
iconfontColor
,
tabBarItem
,
tabBar2
)],
8
,
[
"
onClick
"
]);
}
function
createTabBarItemBdTsx
(
color
,
iconPath
,
tabBarItem
,
tabBar2
)
{
function
createTabBarItemBdTsx
(
color
,
iconPath
,
iconfontText
,
iconfontColor
,
tabBarItem
,
tabBar2
)
{
const
{
height
}
=
tabBar2
;
...
...
@@ -10270,7 +10272,7 @@ function createTabBarItemBdTsx(color, iconPath, tabBarItem, tabBar2) {
"
style
"
:
{
height
}
},
[
iconPath
&&
createTabBarItemIconTsx
(
iconPath
,
tabBarItem
,
tabBar2
),
tabBarItem
.
text
&&
createTabBarItemTextTsx
(
color
,
tabBarItem
,
tabBar2
)],
4
);
},
[
icon
fontText
?
createTabBarItemIconfontTsx
(
iconfontText
,
iconfontColor
||
BLUR_EFFECT_COLOR_DARK
,
tabBarItem
,
tabBar2
)
:
icon
Path
&&
createTabBarItemIconTsx
(
iconPath
,
tabBarItem
,
tabBar2
),
tabBarItem
.
text
&&
createTabBarItemTextTsx
(
color
,
tabBarItem
,
tabBar2
)],
4
);
}
function
createTabBarItemIconTsx
(
iconPath
,
tabBarItem
,
tabBar2
)
{
const
{
...
...
@@ -10293,6 +10295,33 @@ function createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2) {
"
src
"
:
getRealPath
(
iconPath
)
},
null
,
8
,
[
"
src
"
]),
redDot
&&
createTabBarItemRedDotTsx
(
tabBarItem
.
badge
)],
6
);
}
function
createTabBarItemIconfontTsx
(
iconfontText
,
iconfontColor
,
tabBarItem
,
tabBar2
)
{
var
_a
;
const
{
type
,
text
,
redDot
}
=
tabBarItem
;
const
{
iconWidth
}
=
tabBar2
;
const
clazz2
=
"
uni-tabbar__icon
"
+
(
text
?
"
uni-tabbar__icon__diff
"
:
""
);
const
style
=
{
width
:
iconWidth
,
height
:
iconWidth
};
const
iconfontStyle
=
{
fontSize
:
((
_a
=
tabBarItem
.
iconfont
)
==
null
?
void
0
:
_a
.
fontSize
)
||
iconWidth
,
color
:
iconfontColor
};
return
vue
.
createVNode
(
"
div
"
,
{
"
class
"
:
clazz2
,
"
style
"
:
style
},
[
type
!==
"
midButton
"
&&
vue
.
createVNode
(
"
div
"
,
{
"
class
"
:
"
uni-tabbar__iconfont
"
,
"
style
"
:
iconfontStyle
},
[
iconfontText
],
4
),
redDot
&&
createTabBarItemRedDotTsx
(
tabBarItem
.
badge
)],
6
);
}
function
createTabBarItemTextTsx
(
color
,
tabBarItem
,
tabBar2
)
{
const
{
redDot
,
...
...
@@ -10320,7 +10349,7 @@ function createTabBarItemRedDotTsx(badge) {
"
class
"
:
clazz2
},
[
badge
],
2
);
}
function
createTabBarMidButtonTsx
(
color
,
iconPath
,
midButton
,
tabBar2
,
index2
,
onSwitchTab
)
{
function
createTabBarMidButtonTsx
(
color
,
iconPath
,
iconfontText
,
iconfontColor
,
midButton
,
tabBar2
,
index2
,
onSwitchTab
)
{
const
{
width
,
height
,
...
...
@@ -10348,7 +10377,7 @@ function createTabBarMidButtonTsx(color, iconPath, midButton, tabBar2, index2, o
height
:
iconWidth
},
"
src
"
:
getRealPath
(
iconPath
)
},
null
,
12
,
[
"
src
"
])],
4
),
createTabBarItemBdTsx
(
color
,
iconPath
,
midButton
,
tabBar2
)],
12
,
[
"
onClick
"
]);
},
null
,
12
,
[
"
src
"
])],
4
),
createTabBarItemBdTsx
(
color
,
iconPath
,
iconfontText
,
iconfontColor
,
midButton
,
tabBar2
)],
12
,
[
"
onClick
"
]);
}
var
LayoutComponent
=
/* @__PURE__ */
defineSystemComponent
({
name
:
"
Layout
"
,
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
9b2812b4
...
...
@@ -19275,7 +19275,13 @@ const stopPullDownRefresh = /* @__PURE__ */ defineAsyncApi(API_STOP_PULL_DOWN_RE
UniServiceJSBridge.invokeViewMethod(API_STOP_PULL_DOWN_REFRESH, {}, getCurrentPageId());
resolve();
});
const setTabBarItemProps = ["text", "iconPath", "selectedIconPath", "visible"];
const setTabBarItemProps = [
"text",
"iconPath",
"iconfont",
"selectedIconPath",
"visible"
];
const setTabBarStyleProps = [
"color",
"selectedColor",
...
...
@@ -19372,6 +19378,7 @@ const removeTabBarBadge = /* @__PURE__ */ defineAsyncApi(API_REMOVE_TAB_BAR_BADG
const setTabBarBadge = /* @__PURE__ */ defineAsyncApi(API_SET_TAB_BAR_BADGE, (args, { resolve }) => {
setTabBar(API_SET_TAB_BAR_BADGE, args, resolve);
}, SetTabBarBadgeProtocol, SetTabBarBadgeOptions);
const UNI_TABBAR_ICON_FONT = "UniTabbarIconFont";
var TabBar = /* @__PURE__ */ defineSystemComponent({
name: "TabBar",
setup() {
...
...
@@ -19385,6 +19392,14 @@ var TabBar = /* @__PURE__ */ defineSystemComponent({
borderStyle,
placeholderStyle
} = useTabBarStyle(tabBar2);
onMounted(() => {
if (tabBar2.iconfontSrc) {
loadFontFace({
family: UNI_TABBAR_ICON_FONT,
source: `url("${tabBar2.iconfontSrc}")`
});
}
});
return () => {
const tabBarItemsTsx = createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList);
return createVNode("uni-tabbar", {
...
...
@@ -19521,20 +19536,22 @@ function createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList) {
const selected = selectedIndex === index2;
const textColor = selected ? selectedColor : color;
const iconPath = (selected ? item.selectedIconPath || item.iconPath : item.iconPath) || "";
const iconfontText = item.iconfont ? selected ? item.iconfont.selectedText || item.iconfont.text : item.iconfont.text : void 0;
const iconfontColor = item.iconfont ? selected ? item.iconfont.selectedColor || item.iconfont.color : item.iconfont.color : void 0;
if (!__UNI_FEATURE_TABBAR_MIDBUTTON__) {
return createTabBarItemTsx(textColor, iconPath, item, tabBar2, index2, onSwitchTab);
return createTabBarItemTsx(textColor, iconPath, i
confontText, iconfontColor, i
tem, tabBar2, index2, onSwitchTab);
}
return isMidButton(item) ? createTabBarMidButtonTsx(textColor, iconPath, i
tem, tabBar2, index2, onSwitchTab) : createTabBarItemTsx(textColor, iconPath
, item, tabBar2, index2, onSwitchTab);
return isMidButton(item) ? createTabBarMidButtonTsx(textColor, iconPath, i
confontText, iconfontColor, item, tabBar2, index2, onSwitchTab) : createTabBarItemTsx(textColor, iconPath, iconfontText, iconfontColor
, item, tabBar2, index2, onSwitchTab);
});
}
function createTabBarItemTsx(color, iconPath, tabBarItem, tabBar2, index2, onSwitchTab) {
function createTabBarItemTsx(color, iconPath,
iconfontText, iconfontColor,
tabBarItem, tabBar2, index2, onSwitchTab) {
return createVNode("div", {
"key": index2,
"class": "uni-tabbar__item",
"onClick": onSwitchTab(tabBarItem, index2)
}, [createTabBarItemBdTsx(color, iconPath || "", tabBarItem, tabBar2)], 8, ["onClick"]);
}, [createTabBarItemBdTsx(color, iconPath || "",
iconfontText, iconfontColor,
tabBarItem, tabBar2)], 8, ["onClick"]);
}
function createTabBarItemBdTsx(color, iconPath, tabBarItem, tabBar2) {
function createTabBarItemBdTsx(color, iconPath,
iconfontText, iconfontColor,
tabBarItem, tabBar2) {
const {
height
} = tabBar2;
...
...
@@ -19543,7 +19560,7 @@ function createTabBarItemBdTsx(color, iconPath, tabBarItem, tabBar2) {
"style": {
height
}
}, [iconPath && createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2), tabBarItem.text && createTabBarItemTextTsx(color, tabBarItem, tabBar2)], 4);
}, [icon
fontText ? createTabBarItemIconfontTsx(iconfontText, iconfontColor || BLUR_EFFECT_COLOR_DARK, tabBarItem, tabBar2) : icon
Path && createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2), tabBarItem.text && createTabBarItemTextTsx(color, tabBarItem, tabBar2)], 4);
}
function createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2) {
const {
...
...
@@ -19566,6 +19583,33 @@ function createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2) {
"src": getRealPath(iconPath)
}, null, 8, ["src"]), redDot && createTabBarItemRedDotTsx(tabBarItem.badge)], 6);
}
function createTabBarItemIconfontTsx(iconfontText, iconfontColor, tabBarItem, tabBar2) {
var _a;
const {
type,
text: text2,
redDot
} = tabBarItem;
const {
iconWidth
} = tabBar2;
const clazz2 = "uni-tabbar__icon" + (text2 ? " uni-tabbar__icon__diff" : "");
const style = {
width: iconWidth,
height: iconWidth
};
const iconfontStyle = {
fontSize: ((_a = tabBarItem.iconfont) == null ? void 0 : _a.fontSize) || iconWidth,
color: iconfontColor
};
return createVNode("div", {
"class": clazz2,
"style": style
}, [type !== "midButton" && createVNode("div", {
"class": "uni-tabbar__iconfont",
"style": iconfontStyle
}, [iconfontText], 4), redDot && createTabBarItemRedDotTsx(tabBarItem.badge)], 6);
}
function createTabBarItemTextTsx(color, tabBarItem, tabBar2) {
const {
redDot,
...
...
@@ -19593,7 +19637,7 @@ function createTabBarItemRedDotTsx(badge) {
"class": clazz2
}, [badge], 2);
}
function createTabBarMidButtonTsx(color, iconPath, midButton, tabBar2, index2, onSwitchTab) {
function createTabBarMidButtonTsx(color, iconPath,
iconfontText, iconfontColor,
midButton, tabBar2, index2, onSwitchTab) {
const {
width,
height,
...
...
@@ -19621,7 +19665,7 @@ function createTabBarMidButtonTsx(color, iconPath, midButton, tabBar2, index2, o
height: iconWidth
},
"src": getRealPath(iconPath)
}, null, 12, ["src"])], 4), createTabBarItemBdTsx(color, iconPath, midButton, tabBar2)], 12, ["onClick"]);
}, null, 12, ["src"])], 4), createTabBarItemBdTsx(color, iconPath,
iconfontText, iconfontColor,
midButton, tabBar2)], 12, ["onClick"]);
}
const DEFAULT_CSS_VAR_VALUE = "0px";
let globalLayoutState = void 0;
...
...
packages/uts/bin/uts.js
0 → 100755
浏览文件 @
9b2812b4
#!/usr/bin/env node
require
(
'
../dist/cli.js
'
)
packages/uts/dist/index.d.ts
浏览文件 @
9b2812b4
export
interface
ToOptions
{
watch
?:
boolean
;
input
:
{
/**
* 插件根目录
*/
dir
:
string
;
/**
* 文件后缀,默认 .uts
*/
extname
?:
string
;
};
output
:
{
/**
* 输出目录
*/
dir
:
string
;
/**
* 是否生成 sourceMap,为 string 时,表示生成的 sourceMap 目标目录
*/
sourceMap
:
boolean
|
string
;
/**
* sourceMap 中是否包含源码
*/
inlineSourcesContent
?:
boolean
;
};
}
...
...
packages/uts/package.json
浏览文件 @
9b2812b4
...
...
@@ -2,9 +2,13 @@
"name"
:
"@dcloudio/uts"
,
"version"
:
"3.0.0-alpha-3040820220424001"
,
"description"
:
"uts"
,
"bin"
:
{
"uts"
:
"bin/uts.js"
},
"main"
:
"dist/index.js"
,
"types"
:
"dist/index.d.ts"
,
"files"
:
[
"bin"
,
"dist"
],
"repository"
:
{
...
...
packages/uts/src/cli
/index
.ts
→
packages/uts/src/cli.ts
浏览文件 @
9b2812b4
import
{
cac
}
from
'
cac
'
import
{
runBuild
,
runDev
,
ToOptions
}
from
'
.
.
'
import
{
runBuild
,
runDev
,
ToOptions
}
from
'
.
'
const
cli
=
cac
(
'
uts
'
)
...
...
@@ -34,7 +34,6 @@ cli
})
.
action
((
input
,
output
,
opts
:
CliOptions
)
=>
{
const
toOptions
:
ToOptions
=
{
watch
:
opts
.
watch
,
input
:
{
dir
:
input
,
extname
:
opts
.
extname
,
...
...
@@ -51,5 +50,5 @@ cli
})
cli
.
help
()
cli
.
version
(
require
(
'
../
../
package.json
'
).
version
)
cli
.
version
(
require
(
'
../package.json
'
).
version
)
cli
.
parse
()
packages/uts/src/index.ts
浏览文件 @
9b2812b4
...
...
@@ -7,14 +7,28 @@ import { InputKotlinOptions, toKotlin } from './api'
import
{
OutputKotlinOptions
,
UtsKotlinOptions
}
from
'
./types
'
export
interface
ToOptions
{
watch
?:
boolean
input
:
{
/**
* 插件根目录
*/
dir
:
string
/**
* 文件后缀,默认 .uts
*/
extname
?:
string
}
output
:
{
/**
* 输出目录
*/
dir
:
string
/**
* 是否生成 sourceMap,为 string 时,表示生成的 sourceMap 目标目录
*/
sourceMap
:
boolean
|
string
/**
* sourceMap 中是否包含源码
*/
inlineSourcesContent
?:
boolean
}
}
...
...
packages/uts/tsconfig.json
浏览文件 @
9b2812b4
{
"extends"
:
"../../tsconfig.node.json"
,
"compilerOptions"
:
{
"outDir"
:
"dist"
"outDir"
:
"dist"
,
"removeComments"
:
false
},
"include"
:
[
"src"
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录