Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_38335589
uni-app
提交
6f851066
U
uni-app
项目概览
weixin_38335589
/
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,发现更多精彩内容 >>
提交
6f851066
编写于
10月 31, 2019
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'v3' of github.com:dcloudio/uni-app into v3
上级
c22f0d67
23ca9e3e
变更
40
展开全部
隐藏空白更改
内联
并排
Showing
40 changed file
with
6053 addition
and
3776 deletion
+6053
-3776
lerna.json
lerna.json
+1
-1
packages/uni-app-plus-nvue/package.json
packages/uni-app-plus-nvue/package.json
+2
-2
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+9
-9
packages/uni-app-plus/dist/service.runtime.esm.js
packages/uni-app-plus/dist/service.runtime.esm.js
+20
-15
packages/uni-app-plus/dist/view.css
packages/uni-app-plus/dist/view.css
+1393
-1
packages/uni-app-plus/dist/view.umd.js
packages/uni-app-plus/dist/view.umd.js
+4435
-3673
packages/uni-app-plus/package.json
packages/uni-app-plus/package.json
+2
-2
packages/uni-cli-shared/package.json
packages/uni-cli-shared/package.json
+2
-2
packages/uni-h5-ui/package.json
packages/uni-h5-ui/package.json
+2
-2
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-h5/package.json
packages/uni-h5/package.json
+2
-2
packages/uni-mp-alipay/package.json
packages/uni-mp-alipay/package.json
+2
-2
packages/uni-mp-baidu/package.json
packages/uni-mp-baidu/package.json
+2
-2
packages/uni-mp-qq/package.json
packages/uni-mp-qq/package.json
+2
-2
packages/uni-mp-toutiao/package.json
packages/uni-mp-toutiao/package.json
+2
-2
packages/uni-mp-weixin/package.json
packages/uni-mp-weixin/package.json
+2
-2
packages/uni-stat/package.json
packages/uni-stat/package.json
+2
-2
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
...ompiler/__tests__/compiler-app-plus-extra.service.spec.js
+11
-0
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.view.spec.js
...e-compiler/__tests__/compiler-app-plus-extra.view.spec.js
+11
-1
packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js
...late-compiler/__tests__/compiler-app-plus.service.spec.js
+4
-4
packages/uni-template-compiler/__tests__/compiler-app-plus.view.spec.js
...emplate-compiler/__tests__/compiler-app-plus.view.spec.js
+3
-3
packages/uni-template-compiler/__tests__/demo.js
packages/uni-template-compiler/__tests__/demo.js
+2
-2
packages/uni-template-compiler/lib/app/optimizer.js
packages/uni-template-compiler/lib/app/optimizer.js
+7
-3
packages/uni-template-compiler/lib/app/parser/base-parser.js
packages/uni-template-compiler/lib/app/parser/base-parser.js
+11
-0
packages/uni-template-compiler/lib/app/parser/component-parser.js
.../uni-template-compiler/lib/app/parser/component-parser.js
+5
-4
packages/uni-template-compiler/lib/app/service.js
packages/uni-template-compiler/lib/app/service.js
+2
-0
packages/uni-template-compiler/lib/app/util.js
packages/uni-template-compiler/lib/app/util.js
+4
-1
packages/uni-template-compiler/lib/app/view.js
packages/uni-template-compiler/lib/app/view.js
+39
-2
packages/uni-template-compiler/lib/index.js
packages/uni-template-compiler/lib/index.js
+2
-3
packages/uni-template-compiler/lib/util.js
packages/uni-template-compiler/lib/util.js
+6
-2
packages/uni-template-compiler/package.json
packages/uni-template-compiler/package.json
+2
-2
packages/vue-cli-plugin-hbuilderx/package.json
packages/vue-cli-plugin-hbuilderx/package.json
+2
-2
packages/vue-cli-plugin-uni-optimize/package.json
packages/vue-cli-plugin-uni-optimize/package.json
+2
-2
packages/vue-cli-plugin-uni/package.json
packages/vue-cli-plugin-uni/package.json
+3
-3
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/main.js
...i-plugin-uni/packages/webpack-uni-app-loader/view/main.js
+4
-2
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/script.js
...plugin-uni/packages/webpack-uni-app-loader/view/script.js
+11
-3
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/util.js
...i-plugin-uni/packages/webpack-uni-app-loader/view/util.js
+11
-3
packages/webpack-uni-mp-loader/lib/babel/scoped-component-traverse.js
...pack-uni-mp-loader/lib/babel/scoped-component-traverse.js
+26
-8
packages/webpack-uni-mp-loader/package.json
packages/webpack-uni-mp-loader/package.json
+2
-2
packages/webpack-uni-pages-loader/package.json
packages/webpack-uni-pages-loader/package.json
+2
-2
未找到文件。
lerna.json
浏览文件 @
6f851066
...
...
@@ -12,5 +12,5 @@
"message"
:
"chore(release): publish %s"
}
},
"version"
:
"3.0.0-alpha-2402019101801
2
"
"version"
:
"3.0.0-alpha-2402019101801
7
"
}
packages/uni-app-plus-nvue/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-app-plus-nvue"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app app-plus-nvue"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
6f851066
...
...
@@ -3173,7 +3173,7 @@ var serviceContext = (function () {
return
invokeVmMethodWithoutArgs
(
ctx
,
'
pause
'
)
},
seek
(
ctx
,
args
)
{
return
invokeVmMethod
(
ctx
,
'
seek
'
,
args
)
return
invokeVmMethod
(
ctx
,
'
seek
'
,
args
.
position
)
},
stop
(
ctx
)
{
return
invokeVmMethodWithoutArgs
(
ctx
,
'
stop
'
)
...
...
@@ -3182,7 +3182,7 @@ var serviceContext = (function () {
return
invokeVmMethod
(
ctx
,
'
sendDanmu
'
,
args
)
},
playbackRate
(
ctx
,
args
)
{
return
invokeVmMethod
(
ctx
,
'
playbackRate
'
,
args
)
return
invokeVmMethod
(
ctx
,
'
playbackRate
'
,
args
.
rate
)
},
requestFullScreen
(
ctx
,
args
)
{
return
invokeVmMethod
(
ctx
,
'
requestFullScreen
'
,
args
)
...
...
@@ -7999,7 +7999,7 @@ var serviceContext = (function () {
createMapContext
:
createMapContext$1
});
const
RATES
=
[
0.5
,
0.8
,
1.0
,
1.25
,
1.5
];
const
RATES
=
[
0.5
,
0.8
,
1.0
,
1.25
,
1.5
,
2.0
];
function
operateVideoPlayer$3
(
videoId
,
pageVm
,
type
,
data
)
{
invokeMethod
(
'
operateVideoPlayer
'
,
videoId
,
pageVm
,
type
,
data
);
...
...
@@ -8021,8 +8021,8 @@ var serviceContext = (function () {
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
stop
'
);
}
seek
(
position
)
{
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
seek
'
,
{
position
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
seek
'
,
{
position
});
}
sendDanmu
(
args
)
{
...
...
@@ -8032,12 +8032,12 @@ var serviceContext = (function () {
if
(
!~
RATES
.
indexOf
(
rate
))
{
rate
=
1.0
;
}
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
playbackRate
'
,
{
rate
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
playbackRate
'
,
{
rate
});
}
requestFullScreen
()
{
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
requestFullScreen
'
);
requestFullScreen
(
args
=
{}
)
{
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
requestFullScreen
'
,
args
);
}
exitFullScreen
()
{
operateVideoPlayer$3
(
this
.
id
,
this
.
pageVm
,
'
exitFullScreen
'
);
...
...
packages/uni-app-plus/dist/service.runtime.esm.js
浏览文件 @
6f851066
...
...
@@ -695,7 +695,13 @@ var uid = 0;
* directives subscribing to it.
*/
var
Dep
=
function
Dep
()
{
this
.
id
=
uid
++
;
// fixed by xxxxxx (nvue vuex)
/* eslint-disable no-undef */
if
(
typeof
SharedObject
!==
'
undefined
'
){
this
.
id
=
SharedObject
.
uid
++
;
}
else
{
this
.
id
=
uid
++
;
}
this
.
subs
=
[];
};
...
...
@@ -708,8 +714,8 @@ Dep.prototype.removeSub = function removeSub (sub) {
};
Dep
.
prototype
.
depend
=
function
depend
()
{
if
(
Dep
.
target
)
{
Dep
.
target
.
addDep
(
this
);
if
(
Dep
.
SharedObject
.
target
)
{
// fixed by xxxxxx
Dep
.
SharedObject
.
target
.
addDep
(
this
);
}
};
...
...
@@ -730,17 +736,20 @@ Dep.prototype.notify = function notify () {
// The current target watcher being evaluated.
// This is globally unique because only one watcher
// can be evaluated at a time.
Dep
.
target
=
null
;
var
targetStack
=
[];
// fixed by xxxxxx (nvue shared vuex)
/* eslint-disable no-undef */
Dep
.
SharedObject
=
typeof
SharedObject
!==
'
undefined
'
?
SharedObject
:
{};
Dep
.
SharedObject
.
target
=
null
;
Dep
.
SharedObject
.
targetStack
=
[];
function
pushTarget
(
target
)
{
targetStack
.
push
(
target
);
Dep
.
target
=
target
;
Dep
.
SharedObject
.
targetStack
.
push
(
target
);
Dep
.
SharedObject
.
target
=
target
;
}
function
popTarget
()
{
targetStack
.
pop
();
Dep
.
target
=
targetStack
[
targetStack
.
length
-
1
];
Dep
.
SharedObject
.
targetStack
.
pop
();
Dep
.
SharedObject
.
target
=
Dep
.
SharedObject
.
targetStack
[
Dep
.
SharedObject
.
targetStack
.
length
-
1
];
}
/* */
...
...
@@ -1019,7 +1028,7 @@ function defineReactive$$1 (
configurable
:
true
,
get
:
function
reactiveGetter
()
{
var
value
=
getter
?
getter
.
call
(
obj
)
:
val
;
if
(
Dep
.
target
)
{
if
(
Dep
.
SharedObject
.
target
)
{
// fixed by xxxxxx
dep
.
depend
();
if
(
childOb
)
{
childOb
.
dep
.
depend
();
...
...
@@ -4843,7 +4852,7 @@ function createComputedGetter (key) {
if
(
watcher
.
dirty
)
{
watcher
.
evaluate
();
}
if
(
Dep
.
target
)
{
if
(
Dep
.
SharedObject
.
target
)
{
// fixed by xxxxxx
watcher
.
depend
();
}
return
watcher
.
value
...
...
@@ -6792,10 +6801,6 @@ var plugin = {
Vue
.
prototype
.
_$queue
=
queue
;
Vue
.
prototype
.
_m
=
function
renderStatic
()
{
return
this
.
_e
()
};
Vue
.
prototype
.
__call_hook
=
callHook$2
;
// 运行时需要格式化 class,style
Vue
.
prototype
.
_$stringifyClass
=
stringifyClass
;
...
...
packages/uni-app-plus/dist/view.css
浏览文件 @
6f851066
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/view.umd.js
浏览文件 @
6f851066
此差异已折叠。
点击以展开。
packages/uni-app-plus/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-app-plus"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app app-plus"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-cli-shared/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-cli-shared"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-cli-shared"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
...
...
@@ -21,5 +21,5 @@
"hash-sum"
:
"^1.0.2"
,
"strip-json-comments"
:
"^2.0.1"
},
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-h5-ui/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-h5-ui"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app h5 ui"
,
"main"
:
"dist/index.umd.min.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
6f851066
此差异已折叠。
点击以展开。
packages/uni-h5/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-h5"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app h5"
,
"main"
:
"dist/index.umd.min.js"
,
"repository"
:
{
...
...
@@ -18,5 +18,5 @@
"intersection-observer"
:
"^0.7.0"
,
"safe-area-insets"
:
"^1.4.1"
},
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-mp-alipay/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-mp-alipay"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app mp-alipay"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-mp-baidu/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-mp-baidu"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app mp-baidu"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-mp-qq/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-mp-qq"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app mp-qq"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-mp-toutiao/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-mp-toutiao"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app mp-toutiao"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-mp-weixin/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-mp-weixin"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app mp-weixin"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-stat/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-stat"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
""
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -34,5 +34,5 @@
"rollup-plugin-replace"
:
"^2.2.0"
,
"rollup-plugin-uglify"
:
"^6.0.2"
},
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
浏览文件 @
6f851066
...
...
@@ -70,6 +70,17 @@ describe('codegen', () => {
'
<current-user v-slot="{ user }">{{ user.firstName }}</current-user>
'
,
`with(this){return _c('current-user',{attrs:{"_i":0},scopedSlots:_u([{key:"default",fn:function({ user }){return [_v((_$s(0,'t0',_s(user.firstName))))]}}])})}`
)
})
it
(
'
generate keep-alive
'
,
()
=>
{
assertCodegen
(
`<keep-alive exclude="componentWithStatus1"><component is="componentWithStatus"/></keep-alive>`
,
`with(this){return _c('keep-alive',{attrs:{"exclude":"componentWithStatus1","_i":0}},[_c("componentWithStatus",{tag:"component",attrs:{"_i":1}})],1)}`
)
assertCodegen
(
`<keep-alive :exclude="componentWithStatus1"><component :is="'componentWithStatus'+index"/></keep-alive>`
,
`with(this){return _c('keep-alive',{attrs:{"exclude":_$s(0,'a-exclude',componentWithStatus1),"_i":0}},[_c(_$s(1,'is','componentWithStatus'+index),{tag:"component",attrs:{"_i":1}})],1)}`
)
})
})
/* eslint-enable quotes */
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.view.spec.js
浏览文件 @
6f851066
...
...
@@ -15,7 +15,7 @@ describe('codegen', () => {
it
(
'
generate directive
'
,
()
=>
{
assertCodegen
(
'
<p v-custom1:[arg1].modifier="value1" v-custom2></p>
'
,
`with(this){return _c('v-uni-view',{
directives:[{name:"custom1",rawName:"v-custom1:[arg1].modifier",value:(_$g(0,'v-custom1')),expression:"_$g(0,'v-custom1')",arg:_$g(0,'v-custom1-arg'),modifiers:{"modifier":true}},{name:"custom2",rawName:"v-custom2"}],
attrs:{"_i":0}})}`
`with(this){return _c('v-uni-view',{attrs:{"_i":0}})}`
)
})
it
(
'
generate v-for directive
'
,
()
=>
{
...
...
@@ -45,6 +45,16 @@ describe('codegen', () => {
'
<current-user v-slot="{ user }">{{ user.firstName }}</current-user>
'
,
`with(this){return _c('current-user',{attrs:{"_i":0},scopedSlots:_u([{key:"default",fn:function({ user }){return [_v((_$g(0,'t0')))]}}])})}`
)
})
it
(
'
generate keep-alive
'
,
()
=>
{
assertCodegen
(
`<keep-alive exclude="componentWithStatus1"><component is="componentWithStatus"/></keep-alive>`
,
`with(this){return _c('keep-alive',{attrs:{"exclude":"componentWithStatus1","_i":0}},[_c("componentWithStatus",{tag:"component",attrs:{"_i":1}})],1)}`
)
assertCodegen
(
`<keep-alive :exclude="componentWithStatus1"><component :is="'componentWithStatus'+index"/></keep-alive>`
,
`with(this){return _c('keep-alive',{attrs:{"exclude":_$g(0,'a-exclude'),"_i":0}},[_c(_$g(1,'is'),{tag:"component",attrs:{"_i":1}})],1)}`
)
})
})
/* eslint-enable quotes */
packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js
浏览文件 @
6f851066
...
...
@@ -576,7 +576,7 @@ describe('codegen', () => {
)
assertCodegen
(
'
<div :is="component1"></div>
'
,
`with(this){return _c(
component1
,{tag:"div"})}`
`with(this){return _c(
_$s(0,'is',component1)
,{tag:"div"})}`
)
// maybe a component and normalize type should be 1
assertCodegen
(
...
...
@@ -589,7 +589,7 @@ describe('codegen', () => {
// have "inline-template'"
assertCodegen
(
'
<my-component inline-template><p><span>hello world</span></p></my-component>
'
,
`with(this){return _c('my-component',{attrs:{"_i":0},inlineTemplate:{render:function(){with(this){return _
m(0)}},staticRenderFns:[function(){with(this){return _c('p',[_c('span')])}}
]}})}`
`with(this){return _c('my-component',{attrs:{"_i":0},inlineTemplate:{render:function(){with(this){return _
c('p',[_c('span')])}},staticRenderFns:[
]}})}`
)
// "have inline-template attrs, but not having exactly one child element
assertCodegen
(
...
...
@@ -616,7 +616,7 @@ describe('codegen', () => {
it
(
'
generate static trees inside v-for
'
,
()
=>
{
assertCodegen
(
`<div><div v-for="i in 10"><p><span></span></p></div></div>`
,
`with(this){return _c('div',_l((10),function(i,$10,$20,$30){return _c('div',[_
m(0,true
)])}),0)}`
`with(this){return _c('div',_l((10),function(i,$10,$20,$30){return _c('div',[_
c('p',[_c('span')]
)])}),0)}`
// [`with(this){return _c('p',[_c('span')])}`]
)
})
...
...
@@ -660,7 +660,7 @@ describe('codegen', () => {
it
(
'
does not squash templates inside v-pre
'
,
()
=>
{
assertCodegen
(
'
<div v-pre><template><p>{{msg}}</p></template></div>
'
,
`with(this){return _
m(0
)}`
`with(this){return _
c('div',[[_c('p')]],2
)}`
)
// const template = '<div v-pre><template><p>{{msg}}</p></template></div>'
// const generatedCode = `with(this){return _m(0)}`
...
...
packages/uni-template-compiler/__tests__/compiler-app-plus.view.spec.js
浏览文件 @
6f851066
...
...
@@ -15,12 +15,12 @@ describe('codegen', () => {
it
(
'
generate directive
'
,
()
=>
{
assertCodegen
(
'
<p v-custom1:arg1.modifier="value1" v-custom2></p>
'
,
`with(this){return _c('v-uni-view',{
directives:[{name:"custom1",rawName:"v-custom1:arg1.modifier",value:(_$g(0,'v-custom1')),expression:"_$g(0,'v-custom1')",arg:"arg1",modifiers:{"modifier":true}},{name:"custom2",rawName:"v-custom2"}],
attrs:{"_i":0}})}`
`with(this){return _c('v-uni-view',{attrs:{"_i":0}})}`
)
// extra
assertCodegen
(
'
<p v-custom1:[arg1].modifier="value1" v-custom2></p>
'
,
`with(this){return _c('v-uni-view',{
directives:[{name:"custom1",rawName:"v-custom1:[arg1].modifier",value:(_$g(0,'v-custom1')),expression:"_$g(0,'v-custom1')",arg:_$g(0,'v-custom1-arg'),modifiers:{"modifier":true}},{name:"custom2",rawName:"v-custom2"}],
attrs:{"_i":0}})}`
`with(this){return _c('v-uni-view',{attrs:{"_i":0}})}`
)
})
...
...
@@ -576,7 +576,7 @@ describe('codegen', () => {
)
assertCodegen
(
'
<div :is="component1"></div>
'
,
`with(this){return _c(
component1
,{tag:"v-uni-view",attrs:{"_i":0}})}`
`with(this){return _c(
_$g(0,'is')
,{tag:"v-uni-view",attrs:{"_i":0}})}`
)
// maybe a component and normalize type should be 1
assertCodegen
(
...
...
packages/uni-template-compiler/__tests__/demo.js
浏览文件 @
6f851066
const
compiler
=
require
(
'
../lib
'
)
const
res
=
compiler
.
compile
(
`
<
div :id="'a'+b">A{{ d | e | f }}B{{text}}C</div
>
<
p v-text="test"></p
>
`
,
{
resourcePath
:
'
/User/fxy/Documents/test.wxml
'
,
isReservedTag
:
function
(
tag
)
{
...
...
@@ -13,7 +13,7 @@ const res = compiler.compile(
mp
:
{
platform
:
'
app-plus
'
},
service
:
true
,
//
service: true,
view
:
true
})
console
.
log
(
require
(
'
util
'
).
inspect
(
res
,
{
...
...
packages/uni-template-compiler/lib/app/optimizer.js
浏览文件 @
6f851066
...
...
@@ -14,7 +14,11 @@ function no (a, b, c) {
}
function
isBuiltInTag
(
tag
)
{
if
(
tag
===
'
slot
'
||
tag
===
'
component
'
)
{
if
(
tag
===
'
slot
'
||
tag
===
'
component
'
||
tag
===
'
keep-alive
'
)
{
return
true
}
}
...
...
@@ -48,11 +52,11 @@ function markStatic (node) {
}
delete
node
.
attrs
}
if
(
node
.
type
===
1
)
{
if
(
node
.
type
===
1
)
{
delete
node
.
staticClass
delete
node
.
staticStyle
if
(
node
.
attrs
&&
!
isComponent
(
node
.
tag
))
{
// 移除静态属性
if
(
node
.
attrs
&&
!
isComponent
(
node
.
tag
)
&&
node
.
tag
!==
'
keep-alive
'
)
{
// 移除静态属性
node
.
attrs
=
node
.
attrs
.
filter
(
attr
=>
attr
.
name
===
ID
||
isVar
(
attr
.
value
))
}
...
...
packages/uni-template-compiler/lib/app/parser/base-parser.js
浏览文件 @
6f851066
const
{
ID
,
C_IS
,
V_IF
,
V_FOR
,
V_ELSE_IF
,
...
...
@@ -8,6 +9,15 @@ const {
const
parseTextExpr
=
require
(
'
./text-parser
'
)
function
parseIs
(
el
,
genVar
)
{
if
(
!
el
.
component
)
{
return
}
if
(
isVar
(
el
.
component
))
{
el
.
component
=
genVar
(
C_IS
,
el
.
component
)
}
}
function
parseIf
(
el
,
createGenVar
)
{
if
(
!
el
.
if
)
{
return
...
...
@@ -60,6 +70,7 @@ function parseText (el, parent, state) {
}
module
.
exports
=
{
parseIs
,
parseIf
,
parseFor
,
parseText
,
...
...
packages/uni-template-compiler/lib/app/parser/component-parser.js
浏览文件 @
6f851066
const
{
ID
,
hasOwn
ID
}
=
require
(
'
../util
'
)
const
tags
=
require
(
'
../../../../uni-cli-shared/lib/tags
'
)
const
{
isComponent
}
=
require
(
'
../../util
'
)
// 仅限 view 层
module
.
exports
=
function
parseComponent
(
el
)
{
// 需要把自定义组件的 attrs, props 全干掉
if
(
el
.
tag
&&
!
hasOwn
(
tags
,
el
.
tag
.
replace
(
'
v-uni-
'
,
''
)
))
{
if
(
el
.
tag
&&
isComponent
(
el
.
tag
))
{
// 仅保留 ID
el
.
attrs
&&
(
el
.
attrs
=
el
.
attrs
.
filter
(
attr
=>
attr
.
name
===
ID
))
}
...
...
packages/uni-template-compiler/lib/app/service.js
浏览文件 @
6f851066
...
...
@@ -14,6 +14,7 @@ const {
}
=
require
(
'
../util
'
)
const
{
parseIs
,
parseIf
,
parseFor
,
parseText
,
...
...
@@ -82,6 +83,7 @@ function transformNode (el, parent, state) {
const
genVar
=
createGenVar
(
el
.
attrsMap
[
ID
])
parseIs
(
el
,
genVar
)
parseFor
(
el
,
createGenVar
)
parseKey
(
el
)
...
...
packages/uni-template-compiler/lib/app/util.js
浏览文件 @
6f851066
...
...
@@ -9,6 +9,8 @@ const ITERATOR2 = '$2'
const
ITERATOR3
=
'
$3
'
const
SET_DATA
=
'
_$s
'
const
GET_DATA
=
'
_$g
'
const
C_IS
=
'
is
'
const
V_FOR
=
'
f
'
const
V_IF
=
'
i
'
...
...
@@ -190,7 +192,8 @@ function addHandler (el, name, value, important) {
el
.
plain
=
false
}
module
.
exports
=
{
module
.
exports
=
{
C_IS
,
V_FOR
,
V_IF
,
V_ELSE_IF
,
...
...
packages/uni-template-compiler/lib/app/view.js
浏览文件 @
6f851066
...
...
@@ -9,10 +9,10 @@ const {
}
=
require
(
'
./util
'
)
const
{
parseIs
,
parseIf
,
parseFor
,
parseText
,
parseDirs
,
parseAttrs
,
parseProps
,
parseBinding
...
...
@@ -53,6 +53,41 @@ function parseKey (el) {
}
}
function
parseDirs
(
el
,
genVar
,
ignoreDirs
,
includeDirs
=
[])
{
if
(
!
el
.
directives
)
{
return
}
el
.
directives
=
el
.
directives
.
filter
(
dir
=>
{
if
(
includeDirs
.
indexOf
(
dir
.
name
)
!==
-
1
)
{
if
(
ignoreDirs
.
indexOf
(
dir
.
name
)
===
-
1
)
{
dir
.
value
&&
(
dir
.
value
=
genVar
(
'
v-
'
+
dir
.
name
,
dir
.
value
))
dir
.
isDynamicArg
&&
(
dir
.
arg
=
genVar
(
'
v-
'
+
dir
.
name
+
'
-arg
'
,
dir
.
arg
))
}
return
true
}
})
}
const
includeDirs
=
[
'
text
'
,
'
html
'
,
'
bind
'
,
'
model
'
,
'
show
'
,
'
if
'
,
'
else
'
,
'
else-if
'
,
'
for
'
,
'
on
'
,
'
bind
'
,
'
slot
'
,
'
pre
'
,
'
cloak
'
,
'
once
'
]
const
ignoreDirs
=
[
'
model
'
]
function
transformNode
(
el
,
parent
,
state
)
{
if
(
el
.
type
===
3
)
{
return
...
...
@@ -74,6 +109,8 @@ function transformNode (el, parent, state) {
const
genVar
=
createGenVar
(
el
.
attrsMap
[
ID
])
parseIs
(
el
,
genVar
)
if
(
parseFor
(
el
,
createGenVar
))
{
if
(
el
.
alias
[
0
]
===
'
{
'
)
{
// <div><li v-for=" { a, b } in items"></li></div>
el
.
alias
=
'
$item
'
...
...
@@ -83,7 +120,7 @@ function transformNode (el, parent, state) {
parseIf
(
el
,
createGenVar
)
parseBinding
(
el
,
genVar
)
parseDirs
(
el
,
genVar
,
[
'
model
'
]
)
parseDirs
(
el
,
genVar
,
ignoreDirs
,
includeDirs
)
parseAttrs
(
el
,
genVar
)
parseProps
(
el
,
genVar
)
}
...
...
packages/uni-template-compiler/lib/index.js
浏览文件 @
6f851066
...
...
@@ -30,7 +30,7 @@ module.exports = {
compile
(
source
,
options
=
{})
{
if
(
options
.
service
)
{
(
options
.
modules
||
(
options
.
modules
=
[])).
push
(
require
(
'
./app/service
'
))
options
.
optimize
=
tru
e
// 启用 staticRenderFns
options
.
optimize
=
fals
e
// 启用 staticRenderFns
// domProps => attrs
options
.
mustUseProp
=
()
=>
false
options
.
isReservedTag
=
(
tagName
)
=>
!
isComponent
(
tagName
)
// 非组件均为内置
...
...
@@ -38,12 +38,11 @@ module.exports = {
// clear staticRenderFns
const
compiled
=
compile
(
source
,
options
)
compiled
.
staticRenderFns
.
length
=
0
return
compiled
}
else
if
(
options
.
view
)
{
(
options
.
modules
||
(
options
.
modules
=
[])).
push
(
require
(
'
./app/view
'
))
options
.
optimize
=
false
// 暂不启用 staticRenderFns
options
.
optimize
=
false
// 暂不启用 staticRenderFns
options
.
isReservedTag
=
(
tagName
)
=>
false
// 均为组件
return
compile
(
source
,
options
)
}
...
...
packages/uni-template-compiler/lib/util.js
浏览文件 @
6f851066
...
...
@@ -183,9 +183,13 @@ const {
}
=
require
(
'
./h5
'
)
function
isComponent
(
tagName
)
{
if
(
tagName
===
'
block
'
||
tagName
===
'
template
'
)
{
if
(
tagName
===
'
block
'
||
tagName
===
'
template
'
||
tagName
===
'
keep-alive
'
)
{
return
false
}
}
return
!
hasOwn
(
tags
,
getTagName
(
tagName
.
replace
(
'
v-uni-
'
,
''
)))
}
...
...
packages/uni-template-compiler/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/uni-template-compiler"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-template-compiler"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
...
...
@@ -22,5 +22,5 @@
"@babel/types"
:
"^7.3.3"
,
"vue-template-compiler"
:
"^2.6.10"
},
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/vue-cli-plugin-hbuilderx/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/vue-cli-plugin-hbuilderx"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"HBuilderX plugin for vue-cli 3"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -18,5 +18,5 @@
"css"
:
"~2.2.1"
,
"escodegen"
:
"^1.8.1"
},
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/vue-cli-plugin-uni-optimize/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/vue-cli-plugin-uni-optimize"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app optimize plugin for vue-cli 3"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/vue-cli-plugin-uni/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/vue-cli-plugin-uni"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app plugin for vue-cli 3"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -17,7 +17,7 @@
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"dependencies"
:
{
"@dcloudio/uni-stat"
:
"^3.0.0-alpha-2402019101801
2
"
,
"@dcloudio/uni-stat"
:
"^3.0.0-alpha-2402019101801
7
"
,
"copy-webpack-plugin"
:
"^4.6.0"
,
"cross-env"
:
"^5.2.0"
,
"envinfo"
:
"^6.0.1"
,
...
...
@@ -34,5 +34,5 @@
"wrap-loader"
:
"^0.2.0"
,
"xregexp"
:
"4.0.0"
},
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/main.js
浏览文件 @
6f851066
...
...
@@ -17,7 +17,9 @@ const {
parseComponents
}
=
require
(
'
./util
'
)
function
getDefineComponents
(
components
)
{
function
getDefineComponents
({
components
})
{
return
components
.
map
(({
name
,
source
...
...
@@ -93,7 +95,7 @@ module.exports = function(source, map) {
return
`
import 'uni-pages'
function initView(){
${
getStylesCode
(
this
)}
${
getStylesCode
(
this
)}
injectStyles()
${
getDefineComponents
(
parseComponents
(
source
,
traverse
)).
join
(
'
\n
'
)}
UniViewJSBridge.publishHandler('webviewReady')
...
...
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/script.js
浏览文件 @
6f851066
...
...
@@ -10,7 +10,7 @@ const {
parseComponents
}
=
require
(
'
./util
'
)
function
genComponentCode
(
components
)
{
function
genComponentCode
(
components
)
{
const
importCode
=
[]
const
componentsCode
=
[]
components
.
forEach
(({
...
...
@@ -24,12 +24,20 @@ function genComponentCode (components) {
return
[
importCode
.
join
(
'
\n
'
),
componentsCode
.
join
(
'
,
\n
'
)]
}
function
genCode
(
components
,
css
=
[])
{
function
genCode
({
components
,
options
},
css
=
[])
{
const
optionsCode
=
[]
Object
.
keys
(
options
).
forEach
(
name
=>
{
options
[
name
]
!==
null
&&
optionsCode
.
push
(
`
${
name
}
:
${
options
[
name
]}
`
)
})
const
[
importComponentCode
,
componentsCode
]
=
genComponentCode
(
components
)
// TODO js 内引用 css
return
`
${
importComponentCode
}
export default {
${
optionsCode
.
length
?(
optionsCode
.
join
(
'
,
'
)
+
'
,
'
):
''
}
data(){
return {}
},
...
...
@@ -40,7 +48,7 @@ export default {
`
}
module
.
exports
=
function
(
content
,
map
)
{
module
.
exports
=
function
(
content
,
map
)
{
this
.
cacheable
&&
this
.
cacheable
()
content
=
preprocessor
.
preprocess
(
content
,
jsPreprocessOptions
.
context
,
{
...
...
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/util.js
浏览文件 @
6f851066
const
parser
=
require
(
'
@babel/parser
'
)
function
parseComponents
(
content
,
traverse
)
{
function
parseComponents
(
content
,
traverse
)
{
const
{
state
:
{
options
,
components
}
}
=
traverse
(
parser
.
parse
(
content
,
{
...
...
@@ -15,9 +16,16 @@ function parseComponents (content, traverse) {
'
classProperties
'
]
}),
{
components
:
[]
components
:
[],
options
:
{
name
:
null
,
inheritAttrs
:
null
}
})
return
components
return
{
components
,
options
}
}
module
.
exports
=
{
...
...
packages/webpack-uni-mp-loader/lib/babel/scoped-component-traverse.js
浏览文件 @
6f851066
...
...
@@ -6,10 +6,27 @@ const {
}
=
require
(
'
./util
'
)
function
handleObjectExpression
(
declaration
,
path
,
state
)
{
if
(
state
.
options
)
{
// name,inheritAttrs
Object
.
keys
(
state
.
options
).
forEach
(
name
=>
{
const
optionProperty
=
declaration
.
properties
.
filter
(
prop
=>
{
return
t
.
isObjectProperty
(
prop
)
&&
t
.
isIdentifier
(
prop
.
key
)
&&
prop
.
key
.
name
===
name
})[
0
]
if
(
optionProperty
)
{
if
(
t
.
isStringLiteral
(
optionProperty
.
value
))
{
state
.
options
[
name
]
=
JSON
.
stringify
(
optionProperty
.
value
.
value
)
}
else
{
state
.
options
[
name
]
=
optionProperty
.
value
.
value
}
}
})
}
const
componentsProperty
=
declaration
.
properties
.
filter
(
prop
=>
{
return
t
.
isObjectProperty
(
prop
)
&&
t
.
isIdentifier
(
prop
.
key
)
&&
prop
.
key
.
name
===
'
components
'
t
.
isIdentifier
(
prop
.
key
)
&&
prop
.
key
.
name
===
'
components
'
})[
0
]
if
(
componentsProperty
&&
t
.
isObjectExpression
(
componentsProperty
.
value
))
{
...
...
@@ -27,7 +44,8 @@ function handleObjectExpression (declaration, path, state) {
module
.
exports
=
function
(
ast
,
state
=
{
type
:
'
Component
'
,
components
:
[]
components
:
[],
options
:
{}
})
{
babelTraverse
(
ast
,
{
ExportDefaultDeclaration
(
path
)
{
...
...
@@ -35,15 +53,15 @@ module.exports = function (ast, state = {
if
(
t
.
isObjectExpression
(
declaration
))
{
// export default {components:{}}
handleObjectExpression
(
declaration
,
path
,
state
)
}
else
if
(
t
.
isCallExpression
(
declaration
)
&&
t
.
isMemberExpression
(
declaration
.
callee
)
&&
declaration
.
arguments
.
length
===
1
)
{
// export default Vue.extend({components:{}})
t
.
isMemberExpression
(
declaration
.
callee
)
&&
declaration
.
arguments
.
length
===
1
)
{
// export default Vue.extend({components:{}})
if
(
declaration
.
callee
.
object
.
name
===
'
Vue
'
&&
declaration
.
callee
.
property
.
name
===
'
extend
'
)
{
'
extend
'
)
{
handleObjectExpression
(
declaration
.
arguments
[
0
],
path
,
state
)
}
}
else
if
(
t
.
isClassDeclaration
(
declaration
)
&&
declaration
.
decorators
&&
declaration
.
decorators
.
length
)
{
// export default @Component({components:{}}) class MyComponent extend Vue
declaration
.
decorators
&&
declaration
.
decorators
.
length
)
{
// export default @Component({components:{}}) class MyComponent extend Vue
const
componentDecorator
=
declaration
.
decorators
[
0
]
if
(
t
.
isCallExpression
(
componentDecorator
.
expression
))
{
const
args
=
componentDecorator
.
expression
.
arguments
...
...
packages/webpack-uni-mp-loader/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/webpack-uni-mp-loader"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"webpack-uni-mp-loader"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -16,5 +16,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
packages/webpack-uni-pages-loader/package.json
浏览文件 @
6f851066
{
"name"
:
"@dcloudio/webpack-uni-pages-loader"
,
"version"
:
"3.0.0-alpha-2402019101801
2
"
,
"version"
:
"3.0.0-alpha-2402019101801
7
"
,
"description"
:
"uni-app pages.json loader"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
...
...
@@ -23,5 +23,5 @@
"uni-app"
:
{
"compilerVersion"
:
"2.3.4"
},
"gitHead"
:
"
10184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"
e5da9bbe2de350cb7302245c0e968a5610c65a23
"
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录