Skip to content

Commit

Permalink
Feat: 完善注释
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaoh committed Jan 9, 2024
1 parent 9727623 commit 53cb0eb
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dist/Form/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export declare function toFormData(obj: any, hasBrackets?: boolean, hasIndex?: b
*/
export declare function toQueryString(obj: any, hasBrackets?: boolean, hasIndex?: boolean): URLSearchParams;
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand Down
8 changes: 4 additions & 4 deletions dist/index.source.js
Original file line number Diff line number Diff line change
Expand Up @@ -12346,7 +12346,7 @@
return queryString;
}
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand All @@ -12362,22 +12362,22 @@
function useStateData(initialData) {
var data = initialData;
/**
* 设置表单数据
* 设置数据
* @param value 新的数据
*/
function setData(value) {
data = value;
return data;
}
/**
* 重置表单数据为初始值
* 重置数据为初始值
*/
function resetData() {
data = initialData;
return data;
}
/**
* 获取数据值
* 获取数据
*/
function getData() {
return data;
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6924,7 +6924,7 @@ ___

▸ **useStateData**(`initialData`): (`value`: `any`) => `any`[]

创建用于处理表单数据的钩子函数
创建用于处理数据的钩子函数

**`Example`**

Expand Down
2 changes: 1 addition & 1 deletion es/Form/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export declare function toFormData(obj: any, hasBrackets?: boolean, hasIndex?: b
*/
export declare function toQueryString(obj: any, hasBrackets?: boolean, hasIndex?: boolean): URLSearchParams;
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand Down
8 changes: 4 additions & 4 deletions es/index.source.js
Original file line number Diff line number Diff line change
Expand Up @@ -12340,7 +12340,7 @@ function toQueryString(obj, hasBrackets, hasIndex) {
return queryString;
}
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand All @@ -12356,22 +12356,22 @@ function toQueryString(obj, hasBrackets, hasIndex) {
function useStateData(initialData) {
var data = initialData;
/**
* 设置表单数据
* 设置数据
* @param value 新的数据
*/
function setData(value) {
data = value;
return data;
}
/**
* 重置表单数据为初始值
* 重置数据为初始值
*/
function resetData() {
data = initialData;
return data;
}
/**
* 获取数据值
* 获取数据
*/
function getData() {
return data;
Expand Down
2 changes: 1 addition & 1 deletion html/functions/useStateData.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>Function useStateData</h1></div>
<ul class="tsd-signatures">
<li class="tsd-signature tsd-anchor-link" id="useStateData"><span class="tsd-kind-call-signature">use<wbr/>State<wbr/>Data</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initialData</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><a href="#useStateData" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></li>
<li class="tsd-description">
<div class="tsd-comment tsd-typography"><p>创建用于处理表单数据的钩子函数</p>
<div class="tsd-comment tsd-typography"><p>创建用于处理数据的钩子函数</p>

<h3>Example</h3><pre><code class="language-ts"><span class="hl-0">const</span><span class="hl-1"> [</span><span class="hl-2">getData</span><span class="hl-1">, </span><span class="hl-2">setData</span><span class="hl-1">, </span><span class="hl-2">resetData</span><span class="hl-1">] = </span><span class="hl-3">useStateData</span><span class="hl-1">({</span><span class="hl-4">a:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-4">b:</span><span class="hl-1"> </span><span class="hl-7">2</span><span class="hl-1">, </span><span class="hl-4">c:</span><span class="hl-1"> </span><span class="hl-7">3</span><span class="hl-1">});</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-3">log</span><span class="hl-1">(</span><span class="hl-3">getData</span><span class="hl-1">()); </span><span class="hl-5">/// {a: 1, b: 2, c: 3}</span><br/><span class="hl-3">setData</span><span class="hl-1">({ </span><span class="hl-4">a :</span><span class="hl-1"> </span><span class="hl-7">10</span><span class="hl-1"> }); </span><span class="hl-5">/// {a: 10}</span><br/><span class="hl-3">resetData</span><span class="hl-1">(); </span><span class="hl-5">/// {a: 1, b: 2, c: 3}</span><br/><span class="hl-0">const</span><span class="hl-1"> [</span><span class="hl-2">getData</span><span class="hl-1">, </span><span class="hl-2">setData</span><span class="hl-1">, </span><span class="hl-2">resetData</span><span class="hl-1">] = </span><span class="hl-3">useStateData</span><span class="hl-1">(</span><span class="hl-6">&#39;test&#39;</span><span class="hl-1">);</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-3">log</span><span class="hl-1">(</span><span class="hl-3">getData</span><span class="hl-1">()); </span><span class="hl-5">/// &#39;test&#39;</span><br/><span class="hl-3">setData</span><span class="hl-1">(</span><span class="hl-6">&#39;test001&#39;</span><span class="hl-1">); </span><span class="hl-5">/// &#39;test001&#39;</span><br/><span class="hl-3">resetData</span><span class="hl-1">(); </span><span class="hl-5">/// &#39;test&#39;</span>
</code><button>Copy</button></pre>
Expand Down
2 changes: 1 addition & 1 deletion iife/Form/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export declare function toFormData(obj: any, hasBrackets?: boolean, hasIndex?: b
*/
export declare function toQueryString(obj: any, hasBrackets?: boolean, hasIndex?: boolean): URLSearchParams;
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand Down
8 changes: 4 additions & 4 deletions iife/index.source.js
Original file line number Diff line number Diff line change
Expand Up @@ -12343,7 +12343,7 @@ var $xxx = (function (exports) {
return queryString;
}
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand All @@ -12359,22 +12359,22 @@ var $xxx = (function (exports) {
function useStateData(initialData) {
var data = initialData;
/**
* 设置表单数据
* 设置数据
* @param value 新的数据
*/
function setData(value) {
data = value;
return data;
}
/**
* 重置表单数据为初始值
* 重置数据为初始值
*/
function resetData() {
data = initialData;
return data;
}
/**
* 获取数据值
* 获取数据
*/
function getData() {
return data;
Expand Down
2 changes: 1 addition & 1 deletion lib/Form/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export declare function toFormData(obj: any, hasBrackets?: boolean, hasIndex?: b
*/
export declare function toQueryString(obj: any, hasBrackets?: boolean, hasIndex?: boolean): URLSearchParams;
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand Down
8 changes: 4 additions & 4 deletions lib/index.source.js
Original file line number Diff line number Diff line change
Expand Up @@ -12344,7 +12344,7 @@ function toQueryString(obj, hasBrackets, hasIndex) {
return queryString;
}
/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand All @@ -12360,22 +12360,22 @@ function toQueryString(obj, hasBrackets, hasIndex) {
function useStateData(initialData) {
var data = initialData;
/**
* 设置表单数据
* 设置数据
* @param value 新的数据
*/
function setData(value) {
data = value;
return data;
}
/**
* 重置表单数据为初始值
* 重置数据为初始值
*/
function resetData() {
data = initialData;
return data;
}
/**
* 获取数据值
* 获取数据
*/
function getData() {
return data;
Expand Down
8 changes: 4 additions & 4 deletions src/Form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function toQueryString(obj: any, hasBrackets = false, hasIndex = false):
}

/**
* 创建用于处理表单数据的钩子函数
* 创建用于处理数据的钩子函数
* @example
* const [getData, setData, resetData] = useStateData({a: 1, b: 2, c: 3});
* console.log(getData()); /// {a: 1, b: 2, c: 3}
Expand All @@ -80,7 +80,7 @@ export function useStateData(initialData: any) {
let data = initialData;

/**
* 设置表单数据
* 设置数据
* @param value 新的数据
*/
function setData(value: any) {
Expand All @@ -89,15 +89,15 @@ export function useStateData(initialData: any) {
}

/**
* 重置表单数据为初始值
* 重置数据为初始值
*/
function resetData() {
data = initialData;
return data;
}

/**
* 获取数据值
* 获取数据
*/
function getData() {
return data;
Expand Down

0 comments on commit 53cb0eb

Please sign in to comment.