mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-16 07:51:52 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
<h2 id="Summary" name="Summary">概述</h2>
|
||||
<p><strong>String.raw()</strong> 是一个<a href="Reference/template_strings">模板字符串</a>的标签函数,它的作用类似于 Python 中的字符串前缀 <code>r</code> 和 C# 中的字符串前缀 <code>@</code>,是用来获取一个模板字符串的原始字面量值的。</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code>String.raw(callSite, <em>...substitutions</em>)
|
||||
<pre><code class="language-javascript"><code>String.raw(callSite, <em>...substitutions</em>)
|
||||
String.raw`templateString`</code>
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="Parameters" name="Parameters">参数</h3>
|
||||
<dl>
|
||||
<dt><code>callSite</code></dt>
|
||||
@@ -26,7 +26,7 @@ String.raw`templateString`</code>
|
||||
<p>不要被上面复杂的参数要求吓到,因为像所有的标签函数一样,你通常不需要把它看成一个普通函数,你只需要把它放在模板字符串前面就可以了,而不是在它后面加个括号和一堆参数来调用它,引擎会替你去调用它。</p>
|
||||
<p><code>String.raw()</code> 是唯一一个内置的模板字符串标签函数,因为它太常用了。不过它并没有什么特殊能力,你自己也可以实现一个和它功能一模一样的标签函数。</p>
|
||||
<h2 id="Examples" name="Examples">示例</h2>
|
||||
<pre class="brush: js">String.raw `Hi\n!`;
|
||||
<pre><code class="language-javascript">String.raw `Hi\n!`;
|
||||
// "Hi\\n!",这里得到的不是 Hi 后面跟个换行符,而是跟着 \ 和 n 两个字符
|
||||
|
||||
String.raw `Hi\u000A!`;
|
||||
@@ -39,7 +39,7 @@ String.raw `Hi\n${name}!`;
|
||||
|
||||
String.raw({raw: "test"}, 0, 1, 2);
|
||||
// "t0e1s2t",我认为你通常不需要把它当成普通函数来调用
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user