1 | ### Mock.heredoc(fn)
|
2 |
|
3 | * Mock.heredoc(fn)
|
4 |
|
5 | 以直观、舒适、安全的方式书写(多行)HTML 模板。
|
6 |
|
7 | **使用示例**如下所示:
|
8 |
|
9 | var tpl = Mock.heredoc(function() {
|
10 | /*!
|
11 | {{email}}{{age}}
|
12 | <!-- Mock {
|
13 | email: '@EMAIL',
|
14 | age: '@INT(1,100)'
|
15 | } -->
|
16 | */
|
17 | })
|
18 | console.log(tpl)
|
19 | // =>
|
20 | "{{email}}{{age}}
|
21 | <!-- Mock {
|
22 | email: '@EMAIL',
|
23 | age: '@INT(1,100)'
|
24 | } -->"
|
25 |
|
26 | **相关阅读**
|
27 |
|
28 | * [Creating multiline strings in JavaScript](http://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript)、 |
\ | No newline at end of file |