Comments (2)
补充:并非只支持普通变量、属性访问
https://github1s.com/baidu/san/blob/HEAD/src/parser/integrate-attr.js#L100-L101
// https://baidu.github.io/san/tutorial/template/#%E8%A1%A8%E8%BE%BE%E5%BC%8F
// <!-- 普通变量 -->
// <p>{{name}}</p>
// <!-- 属性访问 -->
// <p>{{person.name}}</p>
// <p>{{persons[1]}}</p>
// <!-- 一元否定 -->
// <p>{{!isOK}}</p>
// <p>{{!!isOK}}</p>
// <!-- 一元取负 -->
// <p>{{-num1 + num2}}</p>
// <!-- 二元运算 -->
// <p>{{num1 + num2}}</p>
// <p>{{num1 - num2}}</p>
// <p>{{num1 * num2}}</p>
// <p>{{num1 / num2}}</p>
// <p>{{num1 + num2 * num3}}</p>
// <!-- 二元关系 -->
// <p>{{num1 > num2}}</p>
// <p>{{num1 !== num2}}</p>
// <!-- 三元条件 -->
// <p>{{num1 > num2 ? num1 : num2}}</p>
// <!-- 括号 -->
// <p>{{a * (b + c)}}</p>
// <!-- 数值 -->
// <p>{{num1 + 200}}</p>
// <!-- 字符串 + 三元条件 -->
// <p>{{item ? ',' + item : ''}}</p>
// <!-- 数组字面量 -->
// <x-list data="{{ persons || [] }}" />
// <!-- 对象字面量 -->
// <x-article data="{{ {title: articleTitle, author: user} }}" />
// <!-- 方法调用 -->
// <p>{{max(num1, num2)}}</p>
module.exports = [
// 普通变量
'Identifier',
// 属性访问
'MemberExpression',
// 一元否定
'UnaryExpression',
// 二元运算
'BinaryExpression',
// 条件
'ConditionalExpression',
// 对象
'ObjectExpression',
// 方法调用
'CallExpression',
// 数组
'ArrayExpression'
]
除了上面外,还支持下面各种方式,似乎是无法穷举的,因此暂时放弃
<p a="{=123=}"></p>
<p a="{=function(){}=}"></p>
from eslint-plugin-san.
此外,下面的方式直接 [San Fatal]
a="{==}"
a="{=...a=}"
这种情况 no-parse-error 能够 cover
因此这个 issue 先关闭了
from eslint-plugin-san.
Related Issues (9)
- 使用san.defineComponent定义的组件,lint报错 HOT 1
- 注意:过滤器仅在插值替换时支持
- 注意: get 方法获取的数据不能直接修改,否则可能导致不一致的问题。数据修改请使用本文下面的 set 、 splice 等方法
- san-ssr 模板中不支持类型转换 HOT 2
- Bug: san/html-quotes 规则自动修复后出现HTML实体编码
- Feature Request: 提议升级 @typescript-eslint/parser 依赖版本 v5+
- Feature Request: 提议san/order-in-components规则对自定义成员方法进行排序检测 HOT 1
- template 中 s-for 中包含 index时会解析报错 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-san.