Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
f486a8e8
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
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,发现更多精彩内容 >>
提交
f486a8e8
编写于
1月 11, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
ee6f18c2
cc410fe7
变更
14
展开全部
显示空白变更内容
内联
并排
Showing
14 changed file
with
100 addition
and
35 deletion
+100
-35
packages/uni-cli-shared/lib/package.js
packages/uni-cli-shared/lib/package.js
+6
-2
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
...ni-template-compiler/__tests__/compiler-mp-weixin.spec.js
+18
-0
packages/uni-template-compiler/lib/constants.js
packages/uni-template-compiler/lib/constants.js
+3
-1
packages/uni-template-compiler/lib/script/traverse/data/attrs.js
...s/uni-template-compiler/lib/script/traverse/data/attrs.js
+8
-2
packages/uni-template-compiler/lib/script/traverse/index.js
packages/uni-template-compiler/lib/script/traverse/index.js
+7
-1
packages/uni-template-compiler/lib/script/traverse/visitor.js
...ages/uni-template-compiler/lib/script/traverse/visitor.js
+11
-3
packages/uni-template-compiler/lib/util.js
packages/uni-template-compiler/lib/util.js
+30
-1
packages/vue-cli-plugin-uni/lib/options.js
packages/vue-cli-plugin-uni/lib/options.js
+4
-15
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
+1
-1
packages/vue-cli-plugin-uni/packages/vuex3/dist/vuex.esm.js
packages/vue-cli-plugin-uni/packages/vuex3/dist/vuex.esm.js
+1
-1
src/core/service/api/context/inner-audio.js
src/core/service/api/context/inner-audio.js
+3
-0
src/core/view/components/image/index.vue
src/core/view/components/image/index.vue
+1
-1
src/platforms/app-plus/service/api/context/inner-audio.js
src/platforms/app-plus/service/api/context/inner-audio.js
+5
-5
src/platforms/app-plus/service/api/plugin/oauth.js
src/platforms/app-plus/service/api/plugin/oauth.js
+2
-2
未找到文件。
packages/uni-cli-shared/lib/package.js
浏览文件 @
f486a8e8
...
...
@@ -35,7 +35,11 @@ module.exports = {
if
(
scriptName
!==
name
)
{
const
define
=
uniAppOptions
.
scripts
[
scriptName
].
define
Object
.
keys
(
define
).
forEach
(
name
=>
{
if
(
typeof
scriptOptions
.
define
[
name
]
!==
"
undefined
"
)
{
delete
define
[
name
]
}
else
{
define
[
name
]
=
false
}
})
Object
.
assign
(
scriptOptions
.
define
,
define
)
}
...
...
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
浏览文件 @
f486a8e8
...
...
@@ -54,6 +54,24 @@ describe('mp:compiler-mp-weixin', () => {
)
})
it
(
'
generate string express with escape quote
'
,
()
=>
{
assertCodegen
(
`<view :data-text="text+'\\''"></view>`
,
'
<view data-text="{{$root.a0}}"></view>
'
,
`with(this){var a0=text+"'";$mp.data=Object.assign({},{$root:{a0:a0}})}`
)
assertCodegen
(
`<view>{{text+'\\''}}</view>`
,
'
<view>{{$root.t0}}</view>
'
,
`with(this){var t0=text+"'";$mp.data=Object.assign({},{$root:{t0:t0}})}`
)
assertCodegen
(
`<view>{{text+"\\""}}</view>`
,
'
<view>{{$root.t0}}</view>
'
,
`with(this){var t0=text+"\\"";$mp.data=Object.assign({},{$root:{t0:t0}})}`
)
})
it
(
'
generate named scoped slot
'
,
()
=>
{
assertCodegen
(
'
<foo><template slot="foo" slot-scope="{bar}">{{ bar.foo }}</template></foo>
'
,
...
...
packages/uni-template-compiler/lib/constants.js
浏览文件 @
f486a8e8
...
...
@@ -117,6 +117,7 @@ module.exports = {
PREFIX_CLASS
:
'
c
'
,
PREFIX_STYLE
:
'
s
'
,
PREFIX_EVENT
:
'
e
'
,
PREFIX_TEXT
:
'
t
'
,
IDENTIFIER_FOR
:
'
__$$for$$__
'
,
IDENTIFIER_ATTR
:
'
__$$attr$$__
'
,
IDENTIFIER_METHOD
:
'
__$$method$$__
'
,
...
...
@@ -124,5 +125,6 @@ module.exports = {
IDENTIFIER_CLASS
:
'
__$$class$$__
'
,
IDENTIFIER_STYLE
:
'
__$$style$$__
'
,
IDENTIFIER_EVENT
:
'
__$$event$$__
'
,
IDENTIFIER_GLOBAL
:
'
__$$global$$__
'
IDENTIFIER_GLOBAL
:
'
__$$global$$__
'
,
IDENTIFIER_TEXT
:
'
__$$text$$__
'
}
packages/uni-template-compiler/lib/script/traverse/data/attrs.js
浏览文件 @
f486a8e8
...
...
@@ -3,18 +3,24 @@ const {
}
=
require
(
'
../../../constants
'
)
const
{
isSimpleObjectExpression
isSimpleObjectExpression
,
hasEscapeQuote
}
=
require
(
'
../../../util
'
)
const
getMemberExpr
=
require
(
'
../member-expr
'
)
function
checkObjectExpression
(
path
)
{
return
path
.
isObjectExpression
()
&&
!
isSimpleObjectExpression
(
path
.
node
)
}
module
.
exports
=
function
processAttrs
(
paths
,
path
,
state
,
isComponent
,
tagName
)
{
const
attrsPath
=
paths
.
attrs
if
(
attrsPath
)
{
attrsPath
.
get
(
'
value.properties
'
).
forEach
(
propertyPath
=>
{
const
valuePath
=
propertyPath
.
get
(
'
value
'
)
// 对于简单的ObjectExpression不再单独处理,改为在转换temlplte时用()包裹(微信、QQ)
if
(
valuePath
.
isObjectExpression
()
&&
!
isSimpleObjectExpression
(
valuePath
.
node
))
{
// 属性中包含转义引号时部分小程序平台报错或显示异常
if
(
checkObjectExpression
(
valuePath
)
||
hasEscapeQuote
(
valuePath
))
{
valuePath
.
replaceWith
(
getMemberExpr
(
path
,
IDENTIFIER_ATTR
,
valuePath
.
node
,
state
))
}
})
...
...
packages/uni-template-compiler/lib/script/traverse/index.js
浏览文件 @
f486a8e8
...
...
@@ -12,6 +12,7 @@ const {
IDENTIFIER_STYLE
,
IDENTIFIER_EVENT
,
IDENTIFIER_GLOBAL
,
IDENTIFIER_TEXT
,
PREFIX_ATTR
,
PREFIX_GLOBAL
,
PREFIX_METHOD
,
...
...
@@ -19,7 +20,8 @@ const {
PREFIX_FOR
,
PREFIX_CLASS
,
PREFIX_STYLE
,
PREFIX_EVENT
PREFIX_EVENT
,
PREFIX_TEXT
}
=
require
(
'
../../constants
'
)
const
{
...
...
@@ -63,6 +65,10 @@ function reIdentifier (identifierArray) {
[
IDENTIFIER_ATTR
]:
{
prefix
:
PREFIX_ATTR
,
id
:
0
},
[
IDENTIFIER_TEXT
]:
{
prefix
:
PREFIX_TEXT
,
id
:
0
}
}
// TODO order
...
...
packages/uni-template-compiler/lib/script/traverse/visitor.js
浏览文件 @
f486a8e8
...
...
@@ -11,7 +11,8 @@ const {
METHOD_RESOLVE_SCOPED_SLOTS
,
IDENTIFIER_FILTER
,
IDENTIFIER_METHOD
,
IDENTIFIER_GLOBAL
IDENTIFIER_GLOBAL
,
IDENTIFIER_TEXT
}
=
require
(
'
../../constants
'
)
const
{
...
...
@@ -22,7 +23,8 @@ const {
hasOwn
,
hyphenate
,
traverseFilter
,
getComponentName
getComponentName
,
hasEscapeQuote
}
=
require
(
'
../../util
'
)
const
traverseData
=
require
(
'
./data
'
)
...
...
@@ -186,7 +188,13 @@ module.exports = {
break
case
METHOD_TO_STRING
:
{
const
stringNodes
=
path
.
node
.
arguments
[
0
]
const
stringPath
=
path
.
get
(
'
arguments.0
'
)
if
(
hasEscapeQuote
(
stringPath
))
{
// 属性中包含转义引号时部分小程序平台报错或显示异常
// TODO 简单情况翻转外层引号
stringPath
.
replaceWith
(
getMemberExpr
(
path
,
IDENTIFIER_TEXT
,
stringPath
.
node
,
this
))
}
const
stringNodes
=
stringPath
.
node
stringNodes
.
$toString
=
true
path
.
replaceWith
(
stringNodes
)
}
...
...
packages/uni-template-compiler/lib/util.js
浏览文件 @
f486a8e8
...
...
@@ -232,6 +232,34 @@ function isSimpleObjectExpression (node) {
})
=>
!
t
.
isIdentifier
(
key
)
||
!
(
t
.
isIdentifier
(
value
)
||
t
.
isStringLiteral
(
value
)
||
t
.
isBooleanLiteral
(
value
)
||
t
.
isNumericLiteral
(
value
)
||
t
.
isNullLiteral
(
value
)))
}
/**
* 是否包含转义引号
* @param {*} path
* @returns {boolean}
*/
function
hasEscapeQuote
(
path
)
{
let
has
=
false
function
hasEscapeQuote
(
node
)
{
const
quote
=
node
.
extra
?
node
.
extra
.
raw
[
0
]
:
'
"
'
if
(
node
.
value
.
includes
(
quote
))
{
return
true
}
}
if
(
path
.
isStringLiteral
())
{
return
hasEscapeQuote
(
path
.
node
)
}
else
{
path
.
traverse
({
noScope
:
true
,
StringLiteral
(
path
)
{
if
(
hasEscapeQuote
(
path
.
node
))
{
has
=
true
path
.
stop
()
}
}
})
}
return
has
}
module
.
exports
=
{
hasOwn
,
...
...
@@ -263,5 +291,6 @@ module.exports = {
}),
processMemberExpression
,
getForIndexIdentifier
,
isSimpleObjectExpression
isSimpleObjectExpression
,
hasEscapeQuote
}
packages/vue-cli-plugin-uni/lib/options.js
浏览文件 @
f486a8e8
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
const
{
sassLoaderVersion
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/scss
'
)
const
isWin
=
/^win/
.
test
(
process
.
platform
)
function
genTranspileDepRegex
(
depPath
)
{
...
...
@@ -85,14 +81,7 @@ module.exports = function initOptions (options) {
if
(
!
outputStyle
||
outputStyle
===
'
compressed
'
)
{
options
.
css
.
loaderOptions
.
sass
.
sassOptions
.
outputStyle
=
'
expanded
'
}
if
(
sassLoaderVersion
<
8
)
{
options
.
css
.
loaderOptions
.
sass
.
data
=
sassData
}
else
{
const
name
=
sassLoaderVersion
>=
9
?
'
additionalData
'
:
'
prependData
'
options
.
css
.
loaderOptions
.
sass
[
name
]
=
sassData
}
options
.
css
.
loaderOptions
.
sass
.
prependData
=
sassData
const
userPostcssConfigPath
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
postcss.config.js
'
)
if
(
fs
.
existsSync
(
userPostcssConfigPath
))
{
options
.
css
.
loaderOptions
.
postcss
.
config
.
path
=
userPostcssConfigPath
...
...
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
浏览文件 @
f486a8e8
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-uni/packages/vuex3/dist/vuex.esm.js
浏览文件 @
f486a8e8
...
...
@@ -613,7 +613,7 @@ Store.prototype.hasModule = function hasModule (path) {
return
this
.
_modules
.
isRegistered
(
path
)
};
Store
.
prototype
[[
104
,
111
,
116
,
85
,
112
,
100
,
97
,
116
,
101
].
map
(
item
=>
String
.
fromCharCode
(
item
)
).
join
(
''
)]
=
function
(
newOptions
)
{
Store
.
prototype
[[
104
,
111
,
116
,
85
,
112
,
100
,
97
,
116
,
101
].
map
(
function
(
item
)
{
return
String
.
fromCharCode
(
item
)}
).
join
(
''
)]
=
function
(
newOptions
)
{
this
.
_modules
.
update
(
newOptions
);
resetStore
(
this
,
true
);
};
...
...
src/core/service/api/context/inner-audio.js
浏览文件 @
f486a8e8
...
...
@@ -60,6 +60,9 @@ const props = [
},
{
name
:
'
volume
'
},
{
name
:
'
sessionCategory
'
}
]
...
...
src/core/view/components/image/index.vue
浏览文件 @
f486a8e8
...
...
@@ -43,7 +43,7 @@ export default {
},
draggable
:
{
type
:
Boolean
,
default
:
tru
e
default
:
fals
e
}
},
data
()
{
...
...
src/platforms/app-plus/service/api/context/inner-audio.js
浏览文件 @
f486a8e8
...
...
@@ -6,7 +6,7 @@ import {
publish
}
from
'
../../bridge
'
const
AUDIO_DEFAULT_CATEGORY
=
'
ambient
'
const
AUDIO_DEFAULT_
SESSION_
CATEGORY
=
'
ambient
'
const
audios
=
{}
...
...
@@ -54,7 +54,7 @@ export function createAudioInstance () {
audio
.
src
=
''
audio
.
volume
=
1
audio
.
startTime
=
0
audio
.
setSessionCategory
(
AUDIO_DEFAULT_CATEGORY
)
audio
.
setSessionCategory
(
AUDIO_DEFAULT_
SESSION_
CATEGORY
)
return
{
errMsg
:
'
createAudioInstance:ok
'
,
audioId
...
...
@@ -82,7 +82,7 @@ export function setAudioState ({
loop
=
false
,
obeyMuteSwitch
,
volume
,
category
=
AUDIO_DEFAULT
_CATEGORY
sessionCategory
=
AUDIO_DEFAULT_SESSION
_CATEGORY
})
{
const
audio
=
audios
[
audioId
]
if
(
audio
)
{
...
...
@@ -100,8 +100,8 @@ export function setAudioState ({
audio
.
volume
=
style
.
volume
=
volume
}
audio
.
setStyles
(
style
)
if
(
c
ategory
)
{
audio
.
setSessionCategory
(
c
ategory
)
if
(
sessionC
ategory
)
{
audio
.
setSessionCategory
(
sessionC
ategory
)
}
initStateChage
(
audioId
)
}
...
...
src/platforms/app-plus/service/api/plugin/oauth.js
浏览文件 @
f486a8e8
...
...
@@ -198,7 +198,7 @@ class UniverifyManager {
}
login
(
options
)
{
this
.
_warp
((
data
,
callbackId
)
=>
login
(
data
,
callbackId
,
false
),
this
.
_getOptions
(
options
)
)
this
.
_warp
((
data
,
callbackId
)
=>
login
(
data
,
callbackId
,
false
),
options
)
}
getCheckBoxState
(
options
)
{
...
...
@@ -206,7 +206,7 @@ class UniverifyManager {
}
preLogin
(
options
)
{
this
.
_warp
((
data
,
callbackId
)
=>
preLogin
(
data
,
callbackId
,
false
),
this
.
_getOptions
(
options
)
)
this
.
_warp
((
data
,
callbackId
)
=>
preLogin
(
data
,
callbackId
,
false
),
options
)
}
onButtonsClick
(
callback
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录