Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
Chameleon
提交
226a420c
C
Chameleon
项目概览
DiDi
/
Chameleon
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Chameleon
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
226a420c
编写于
2月 21, 2019
作者:
J
JiM-W
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
多态组件不进行语法校验,仅仅跨端组件进行语法校验
上级
38a372b8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
6 deletion
+16
-6
packages/chameleon-template-parse/src/common/process-template.js
...s/chameleon-template-parse/src/common/process-template.js
+14
-5
packages/chameleon-tool/chameleon.js
packages/chameleon-tool/chameleon.js
+2
-1
未找到文件。
packages/chameleon-template-parse/src/common/process-template.js
浏览文件 @
226a420c
...
...
@@ -403,18 +403,27 @@ exports.preParseEventSyntax = function (content) {
});
return
content
;
}
// 仅仅对跨端组件进行语法校验:不能是 .web.cml .weex.cml .alipay.cml .wx.cml .baidu.cml结尾的
exports
.
preCheckTemplateSyntax
=
function
(
source
,
type
,
options
)
{
let
{
lang
}
=
options
;
let
{
lang
,
filePath
}
=
options
;
// 多态组件不进行语法校验
let
polymorphicCompSuffix
=
`.
${
type
}
.cml`
;
let
crossPlatformSuffix
=
'
.cml
'
;
let
ispolymorphicComp
=
filePath
.
endsWith
(
polymorphicCompSuffix
);
// 跨端组件肯定不能是 .web.cml .weex.cml .alipay.cml .wx.cml .baidu.cml结尾的
let
iscrossPlatform
=
!
ispolymorphicComp
&&
filePath
.
endsWith
(
crossPlatformSuffix
);
let
errorInfo
if
(
lang
===
'
vue
'
)
{
if
(
lang
===
'
vue
'
&&
iscrossPlatform
)
{
try
{
errorInfo
=
exports
.
preCheckTemplateSyntaxForVue
(
source
,
type
,
options
)
}
catch
(
e
)
{
debugger
;
errorInfo
=
'
vue syntax error
'
}
}
if
(
lang
===
'
cml
'
)
{
if
(
lang
===
'
cml
'
&&
iscrossPlatform
)
{
try
{
errorInfo
=
exports
.
preCheckTemplateSyntaxForCml
(
source
,
type
,
options
)
...
...
@@ -442,7 +451,7 @@ exports.preCheckTemplateSyntaxForVue = function(source, type, options) {
errorInfo
+=
`vue 语法下不能使用
${
node
.
name
.
name
}
;`
!
directiveError
.
includes
(
node
.
name
.
name
)
&&
directiveError
.
push
(
directiveError
)
}
if
(
!
twoWayBindError
&&
t
.
isJSXAttribute
(
node
)
&&
utils
.
isMustacheReactive
(
node
.
value
.
value
))
{
if
(
!
twoWayBindError
&&
t
.
isJSXAttribute
(
node
)
&&
node
.
value
&&
utils
.
isMustacheReactive
(
node
.
value
.
value
))
{
errorInfo
+=
'
vue 语法下不能用 id={{value}},请使用 v-bind:id="value" 或者 :id="value" 进行响应式值的绑定;
'
twoWayBindError
=
true
;
}
...
...
@@ -475,7 +484,7 @@ exports.preCheckTemplateSyntaxForCml = function(source, type, options) {
!
directiveError
.
includes
(
node
.
name
.
name
)
&&
directiveError
.
push
(
directiveError
)
}
if
(
!
twoWayBindError
&&
t
.
isJSXNamespacedName
(
node
.
name
)
&&
node
.
name
.
namespace
.
name
===
'
v-bind
'
)
{
errorInfo
+=
'
cml 语法下不能用 :id="value" 或者 v-bind:id="value"进行响应式的值
得
双向绑定,请使用 id={{value}} ;
'
errorInfo
+=
'
cml 语法下不能用 :id="value" 或者 v-bind:id="value"进行响应式的值
的
双向绑定,请使用 id={{value}} ;
'
twoWayBindError
=
true
;
}
if
(
!
eventBindingError
&&
t
.
isJSXNamespacedName
(
node
.
name
)
&&
node
.
name
.
namespace
.
name
===
'
v-on
'
)
{
...
...
packages/chameleon-tool/chameleon.js
浏览文件 @
226a420c
#! /usr/bin/env node --inspect-brk
#! /usr/bin/env node
// --inspect-brk
require
(
'
./lib/index.js
'
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录