亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站

資訊專欄INFORMATION COLUMN

一次完整的react hooks實踐

kuangcaibao / 2730人閱讀

摘要:本次需求其實就兩個邏輯輸入篩選項。當(dāng)發(fā)生改變時,重新渲染頁面首次進(jìn)入頁面時,無任何篩選項。關(guān)于的一些,官方也有很棒的文檔寫在后面本文通過工作中的一個小需求,完成了一次的實踐,不過上述代碼依然有很多需要優(yōu)化的地方。

寫在前面

本文首發(fā)于公眾號:符合預(yù)期的CoyPan

React在16.8版本正式發(fā)布了Hooks。關(guān)注了很久,最近正好有一個小需求,趕緊來試一下。

需求描述

需求很簡單,部門內(nèi)部的一個數(shù)據(jù)查詢小工具。大致長成下面這樣:

用戶首次訪問頁面,會拉取數(shù)據(jù)展示。輸入篩選條件,點擊查詢后,會再次拉取數(shù)據(jù)在前端展示。

需求實現(xiàn) 使用React Class Component的寫法

如果使用以前的class寫法,簡單寫一下,代碼可能大概長成下面這樣:

import React from "react";
import { Tabs, Input, RangeTime, Button, Table } from "./components";

class App extends React.Component {
    ...
    state = {
        type: [],
        id: "",
        title: "",
        date: [],
        dataList: []
    }
    componentDidMount() {
        this.fetchData();
    }
    render() {
        
        
        
        
        
        
    }
    
    fetchData() {
        ...
        this.setState({
            dataList
        });
    }

    handleTypeChange() {
        ...
        this.setState({
            type,
        });
    }
    
    handleIdChange() {
        ...
        this.setState({
            id,
        });
    }

    handleTitleChange() {
        ...
        this.setState({
            title,
        });
    }

    handleRangeTimeChange() {
        ...
        this.setState({
            date,
        });
    }

    handleQueryBtnClick() {
        ...
    }
    ...
}使用React Hooks的寫法

關(guān)于React hooks的相關(guān)內(nèi)容,這里就不贅述了??梢灾苯硬榭磖eact官方文檔,寫得非常好。

https://reactjs.org/docs/hook...

本次需求其實就兩個邏輯:1、輸入篩選項 。2、查詢數(shù)據(jù)

主頁面一個hooks,處理篩選項以及數(shù)據(jù)展示。數(shù)據(jù)請求邏輯多帶帶弄一個hooks。

主頁面hooks:

import React, { useState, useEffect} from "react";
import { Tabs, Input, RangeTime, Button, Table } from "./components";

const App = () => {
    // 數(shù)據(jù)類型
    const tabs = [{ key: 1, value: "類型1" }, { key: 0, value: "類型2" }];
    const [tab, setTab] = useState(1);
    // 數(shù)據(jù)ID
    const [dataId, setDataid] = useState("");
    // 標(biāo)題
    const [title, setTitle] = useState("");
    // 時間區(qū)間, 默認(rèn)為至今一周時間
    const now = Date.now();
    const [timeRange, setTimeRange] = useState([now - 1000 * 60 * 60 * 24 * 7, now]);
    // 數(shù)據(jù)列表
    const [dataList, setDataList] = useState([]);

    // 點擊搜索按鈕
    function handleBtnClick() {
        // 請求數(shù)據(jù)
        ...
    }

    return 
<Tabs label="類型" tabs={tabs} tab={tab} onChange={setTab} /> <Input value={dataId} placeholder="請輸入數(shù)據(jù)ID" onChange={setDataid}>ID</Input> <Input value={title} placeholder="請輸入數(shù)據(jù)標(biāo)題" onChange={setTitle}>標(biāo)題</Input> <TimeRange label="數(shù)據(jù)時間" value={timeRange} onChange={handleTimeChange}/> <article className="btn-container"> <Button type="primary" onClick={handleBtnClick}> 查詢 </Button> </article> <Table dataList={dataList}></Table> </section> };</pre> <p>上面的代碼,完成了篩選項的處理邏輯。下面來實現(xiàn)負(fù)責(zé)數(shù)據(jù)請求的hooks.</p> <p>數(shù)據(jù)請求hooks:</p> <pre>import React, { useState, useEffect } from "react"; import jsonp from "../tools/jsonp"; function MyFecth(url) { // 是否正在請求中 const [isLoading, setIsLoanding] = useState(false); // 請求參數(shù) const [queryParams, setQueryParams] = useState(null); // 請求結(jié)果 const [data, setData] = useState(null); // 向接口發(fā)起請求 const fetchData = async () => { if(queryParams === null) { return; } setIsLoanding(true); const res = await jsonp({ url: url, data: queryParams }); setData(res); setIsLoanding(false); } // 只要queryParams改變,就發(fā)起請求 useEffect(()=> { fetchData(); }, [queryParams]); // 供外部調(diào)用 const doGet = (params) => { setQueryParams(params); } return { isLoading, data, doGet } } export default MyFecth;</pre> <p>在主頁面中,引用數(shù)據(jù)請求hooks:</p> <pre>import React, { useState, useEffect} from "react"; import { Tabs, Input, RangeTime, Button, Table } from "./components"; import MyFecth from "./MyFetch"; const App = () => { // ①使用數(shù)據(jù)請求hooks const { isLoading, data, doGet } = MyFecth("http://xxx"); // 數(shù)據(jù)類型 const tabs = [{ key: 1, value: "類型1" }, { key: 0, value: "類型2" }]; const [tab, setTab] = useState(1); // 數(shù)據(jù)ID const [dataId, setDataid] = useState(""); // 標(biāo)題 const [title, setTitle] = useState(""); // 時間區(qū)間, 默認(rèn)為至今一周時間 const now = Date.now(); const [timeRange, setTimeRange] = useState([now - 1000 * 60 * 60 * 24 * 7, now]); // 數(shù)據(jù)列表 const [dataList, setDataList] = useState([]); // 點擊搜索按鈕 function handleBtnClick() { // ②點擊按鈕后請求數(shù)據(jù) const params = {}; title && (params.title = title); dataId && (params.dataId = dataId); params.startTime = String(timeRange[0]); params.endTime = String(timeRange[1]); doGet(params); } // ③data改變后,重新渲染列表。 // 這里相當(dāng)于 componentDidUpdate。當(dāng)data發(fā)生改變時,重新渲染頁面 useEffect(() => { setDataList(data); }, [data]); // ④首次進(jìn)入頁面時,無任何篩選項。拉取數(shù)據(jù),渲染頁面。 // useEffect第二個參數(shù)為一個空數(shù)組,相當(dāng)于在 componentDidMount 時執(zhí)行該「副作用」 useEffect(() => { doGet({}); }, []); return <section className="app"> <Title title="數(shù)據(jù)查詢" /> <Tabs label="類型" tabs={tabs} tab={tab} onChange={setTab} /> <Input value={dataId} placeholder="請輸入數(shù)據(jù)ID" onChange={setDataid}>ID</Input> <Input value={title} placeholder="請輸入數(shù)據(jù)標(biāo)題" onChange={setTitle}>標(biāo)題</Input> <TimeRange label="數(shù)據(jù)時間" value={timeRange} onChange={handleTimeChange}/> <article className="btn-container"> <Button type="primary" isLoading={isLoading} onClick={handleBtnClick}> 查詢 </Button> </article> <Table dataList={dataList}></Table> </section> };</pre> <b>關(guān)于React Hooks的一些思考</b> <p>使用hooks寫完這個需求,最直觀的感受就是,代碼寫起來很爽。不需要像以前那樣寫很多的setState。其次就是</p> <p>hooks的api設(shè)計得很優(yōu)秀,一個useState的就能將【狀態(tài)】和【變更狀態(tài)的邏輯】兩兩配對。React的基本思想就是【數(shù)據(jù)到視圖的映射】,在hooks中,使用useEffect來表明其中的【副作用】,感覺react官方也傾向于不區(qū)分componentDidMount和componentDidUpdate。</p> <p>從api設(shè)計就能看出,hooks提倡組件狀態(tài)細(xì)粒度地拆分。在一個hooks組件中,可能包含很多的狀態(tài),如果用戶的某些操作,需要同時修改兩個狀態(tài),那么我需要分別調(diào)用這兩個狀態(tài)的修改邏輯,這樣會導(dǎo)致組件被重新render兩次。而在使用class寫法的組件中,只需要一次setState就好。這樣看來,hooks中render兩次的操作,可能會帶來些許的性能問題 ? 這就要求我們在設(shè)計組件結(jié)構(gòu)和state時,多斟酌,多抽象。</p> <p>關(guān)于hooks的一些FAQ,官方也有很棒的文檔:</p> <p>https://reactjs.org/docs/hook...</p> <b>寫在后面</b> <p>本文通過工作中的一個小需求,完成了一次react hooks的實踐,不過上述代碼依然有很多需要優(yōu)化的地方。這次實踐讓我最直觀的接觸了react hooks,也幫助自己進(jìn)一步理解了react團(tuán)隊的一些思想。符合預(yù)期。</p> <p><script type="text/javascript">showImg("https://segmentfault.com/img/bVbond5?w=1240&h=620");</script></p> </div> <div id="dnkpnhlp" class="mt-64 tags-seach" > <div id="dnkpnhlp" class="tags-info"> <a style="width:120px;" title="GPU云服務(wù)器" href="http://www.ezyhdfw.cn/site/product/gpu.html">GPU云服務(wù)器</a> <a style="width:120px;" title="云服務(wù)器" href="http://www.ezyhdfw.cn/site/active/kuaijiesale.html?ytag=seo">云服務(wù)器</a> <a style="width:120px;" title="React hooks" href="http://www.ezyhdfw.cn/yun/tag/React hooks/">React hooks</a> <a style="width:120px;" title="react-hooks" href="http://www.ezyhdfw.cn/yun/tag/react-hooks/">react-hooks</a> <a style="width:120px;" title="React Hooks 文檔重大更新!" href="http://www.ezyhdfw.cn/yun/tag/React Hooks wendangzhongdagengxin/">React Hooks 文檔重大更新!</a> <a style="width:120px;" title="html的完整格式" href="http://www.ezyhdfw.cn/yun/tag/htmldewanzhenggeshi/">html的完整格式</a> </div> </div> <div id="dnkpnhlp" class="entry-copyright mb-30"> <p class="mb-15"> 文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。</p> <p>轉(zhuǎn)載請注明本文地址:http://www.ezyhdfw.cn/yun/109101.html</p> </div> <ul class="pre-next-page"> <li id="dnkpnhlp" class="ellipsis"><a class="hpf" href="http://www.ezyhdfw.cn/yun/109100.html">上一篇:如何學(xué)習(xí)一門新語言或框架</a></li> <li id="dnkpnhlp" class="ellipsis"><a class="hpf" href="http://www.ezyhdfw.cn/yun/109102.html">下一篇:JavaScript 的 4 種數(shù)組遍歷方法: for VS forEach() VS for/in</a></li> </ul> </div> <div id="dnkpnhlp" class="about_topicone-mid"> <h3 class="top-com-title mb-0"><span data-id="0">相關(guān)文章</span></h3> <ul class="com_white-left-mid atricle-list-box"> <li> <div id="dnkpnhlp" class="atricle-list-right"> <h2 class="ellipsis2"><a class="hpf" href="http://www.ezyhdfw.cn/yun/106582.html"><b>Ant Design Pro - <em>實踐</em><em>React</em> <em>Hooks</em> - 組件</b></a></h2> <p class="ellipsis2 good">摘要:另外,監(jiān)聽事件,更新寬度狀態(tài)。文本真實寬度渲染完成后,通過獲取元素寬度。是否超長比較文本真實寬度和組件的寬度。設(shè)置為其他狀態(tài)或中的狀態(tài)時,只在這些狀態(tài)變化時觸發(fā)注意,依賴為對象時,不會深比較。得益于的用法靈活,組件寫法上確實簡潔不少。 需求 后臺項目,使用Ant Design Pro, 有這樣一個需求:有一個表格,寬度是自適應(yīng)的,表格中有一列是備注,文本長度不定,我們希望在文本過長的時...</p> <div id="dnkpnhlp" class="com_white-left-info"> <div id="dnkpnhlp" class="com_white-left-infol"> <a href="http://www.ezyhdfw.cn/yun/u-1597.html"><img src="http://www.ezyhdfw.cn/yun/data/avatar/000/00/15/small_000001597.jpg" alt=""><span id="dnkpnhlp" class="layui-hide64">twohappy</span></a> <time datetime="">2019-08-26 10:40</time> <span><i class="fa fa-commenting"></i>評論0</span> <span><i class="fa fa-star"></i>收藏0</span> </div> </div> </div> </li> <li> <div id="dnkpnhlp" class="atricle-list-right"> <h2 class="ellipsis2"><a class="hpf" href="http://www.ezyhdfw.cn/yun/99617.html"><b><em>React</em> <em>Hooks</em>實現(xiàn)異步請求實例—useReducer、useContext和useEffec</b></a></h2> <p class="ellipsis2 good">摘要:本文是學(xué)習(xí)了年新鮮出爐的提案之后,針對異步請求數(shù)據(jù)寫的一個案例。注意,本文假設(shè)了你已經(jīng)初步了解的含義了,如果不了解還請移步官方文檔。但不要忘記和上下文對象可以看做是寫法的以及三個鉤子函數(shù)的組合。 本文是學(xué)習(xí)了2018年新鮮出爐的React Hooks提案之后,針對異步請求數(shù)據(jù)寫的一個案例。注意,本文假設(shè)了:1.你已經(jīng)初步了解hooks的含義了,如果不了解還請移步官方文檔。(其實有過翻譯...</p> <div id="dnkpnhlp" class="com_white-left-info"> <div id="dnkpnhlp" class="com_white-left-infol"> <a href="http://www.ezyhdfw.cn/yun/u-1592.html"><img src="http://www.ezyhdfw.cn/yun/data/avatar/000/00/15/small_000001592.jpg" alt=""><span id="dnkpnhlp" class="layui-hide64">Code4App</span></a> <time datetime="">2019-08-23 13:49</time> <span><i class="fa fa-commenting"></i>評論0</span> <span><i class="fa fa-star"></i>收藏0</span> </div> </div> </div> </li> <li> <div id="dnkpnhlp" class="atricle-list-right"> <h2 class="ellipsis2"><a class="hpf" href="http://www.ezyhdfw.cn/yun/109204.html"><b>精讀《Function VS Class 組件》</b></a></h2> <p class="ellipsis2 good">摘要:未來可能成為官方之一。討論地址是精讀組件如果你想?yún)⑴c討論,請點擊這里,每周都有新的主題,周末或周一發(fā)布。前端精讀幫你篩選靠譜的內(nèi)容。 1. 引言 為什么要了解 Function 寫法的組件呢?因為它正在變得越來越重要。 那么 React 中 Function Component 與 Class Component 有何不同? how-are-function-components-di...</p> <div id="dnkpnhlp" class="com_white-left-info"> <div id="dnkpnhlp" class="com_white-left-infol"> <a href="http://www.ezyhdfw.cn/yun/u-1214.html"><img src="http://www.ezyhdfw.cn/yun/data/avatar/000/00/12/small_000001214.jpg" alt=""><span id="dnkpnhlp" class="layui-hide64">FWHeart</span></a> <time datetime="">2019-08-26 13:38</time> <span><i class="fa fa-commenting"></i>評論0</span> <span><i class="fa fa-star"></i>收藏0</span> </div> </div> </div> </li> <li> <div id="dnkpnhlp" class="atricle-list-right"> <h2 class="ellipsis2"><a class="hpf" href="http://www.ezyhdfw.cn/yun/99188.html"><b>精讀《<em>React</em> <em>Hooks</em>》</b></a></h2> <p class="ellipsis2 good">摘要:更容易將組件的與狀態(tài)分離。也就是只提供狀態(tài)處理方法,不會持久化狀態(tài)。大體思路是利用共享一份數(shù)據(jù),作為的數(shù)據(jù)源。精讀帶來的約定函數(shù)必須以命名開頭,因為這樣才方便做檢查,防止用判斷包裹語句。前端精讀幫你篩選靠譜的內(nèi)容。 1 引言 React Hooks 是 React 16.7.0-alpha 版本推出的新特性,想嘗試的同學(xué)安裝此版本即可。 React Hooks 要解決的問題是狀態(tài)共享,...</p> <div id="dnkpnhlp" class="com_white-left-info"> <div id="dnkpnhlp" class="com_white-left-infol"> <a href="http://www.ezyhdfw.cn/yun/u-1396.html"><img src="http://www.ezyhdfw.cn/yun/data/avatar/000/00/13/small_000001396.jpg" alt=""><span id="dnkpnhlp" class="layui-hide64">kohoh_</span></a> <time datetime="">2019-08-23 13:03</time> <span><i class="fa fa-commenting"></i>評論0</span> <span><i class="fa fa-star"></i>收藏0</span> </div> </div> </div> </li> </ul> </div> <div id="dnkpnhlp" class="topicone-box-wangeditor"> <h3 class="top-com-title mb-64"><span>發(fā)表評論</span></h3> <div id="dnkpnhlp" class="xcp-publish-main flex_box_zd"> <div id="dnkpnhlp" class="unlogin-pinglun-box"> <a href="javascript:login()" class="grad">登陸后可評論</a> </div> </div> </div> <div id="dnkpnhlp" class="site-box-content"> <div id="dnkpnhlp" class="site-content-title"> <h3 class="top-com-title mb-64"><span>0條評論</span></h3> </div> <div id="dnkpnhlp" class="pages"></ul></div> </div> </div> <div id="dnkpnhlp" class="layui-col-md4 layui-col-lg3 com_white-right site-wrap-right"> <div id="dnkpnhlp" class=""> <div id="dnkpnhlp" class="com_layuiright-box user-msgbox"> <a href="http://www.ezyhdfw.cn/yun/u-1381.html"><img src="http://www.ezyhdfw.cn/yun/data/avatar/000/00/13/small_000001381.jpg" alt=""></a> <h3><a href="http://www.ezyhdfw.cn/yun/u-1381.html" rel="nofollow">kuangcaibao</a></h3> <h6>男<span>|</span>高級講師</h6> <div id="dnkpnhlp" class="flex_box_zd user-msgbox-atten"> <a href="javascript:attentto_user(1381)" id="attenttouser_1381" class="grad follow-btn notfollow attention">我要關(guān)注</a> <a href="javascript:login()" title="發(fā)私信" >我要私信</a> </div> <div id="dnkpnhlp" class="user-msgbox-list flex_box_zd"> <h3 class="hpf">TA的文章</h3> <a href="http://www.ezyhdfw.cn/yun/ut-1381.html" class="box_hxjz">閱讀更多</a> </div> <ul class="user-msgbox-ul"> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/130642.html">jupyter安裝tensorflow</a></h3> <p>閱讀 1976<span>·</span>2023-04-25 15:51</p></li> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/122427.html">SpringBoot集成Redis</a></h3> <p>閱讀 2586<span>·</span>2021-10-13 09:40</p></li> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/120827.html">Facebook宣布“元宇宙”相關(guān)部門負(fù)責(zé)人晉升首席技術(shù)官</a></h3> <p>閱讀 2253<span>·</span>2021-09-23 11:22</p></li> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/115905.html">浮動布局錯誤</a></h3> <p>閱讀 3331<span>·</span>2019-08-30 14:16</p></li> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/109101.html">一次完整的react hooks實踐</a></h3> <p>閱讀 2731<span>·</span>2019-08-26 13:35</p></li> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/108983.html">React Router4.0</a></h3> <p>閱讀 1926<span>·</span>2019-08-26 13:31</p></li> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/107322.html">也來探討一下Object.assign</a></h3> <p>閱讀 940<span>·</span>2019-08-26 11:39</p></li> <li><h3 class="ellipsis"><a href="http://www.ezyhdfw.cn/yun/106359.html">React源碼解析之React.children.map()</a></h3> <p>閱讀 2817<span>·</span>2019-08-26 10:33</p></li> </ul> </div> <!-- 文章詳情右側(cè)廣告--> <div id="dnkpnhlp" class="com_layuiright-box"> <h6 class="top-com-title"><span>最新活動</span></h6> <div id="dnkpnhlp" class="com_adbox"> <div id="dnkpnhlp" class="layui-carousel" id="right-item"> <div carousel-item> <div> <a href="http://www.ezyhdfw.cn/site/active/kuaijiesale.html?ytag=seo" rel="nofollow"> <img src="http://www.ezyhdfw.cn/yun/data/attach/240625/2rTjEHmi.png" alt="云服務(wù)器"> </a> </div> <div> <a href="http://www.ezyhdfw.cn/site/product/gpu.html" rel="nofollow"> <img src="http://www.ezyhdfw.cn/yun/data/attach/240807/7NjZjdrd.png" alt="GPU云服務(wù)器"> </a> </div> </div> </div> </div> <!-- banner結(jié)束 --> <div id="dnkpnhlp" class="adhtml"> </div> <script> $(function(){ $.ajax({ type: "GET", url:"http://www.ezyhdfw.cn/yun/ad/getad/1.html", cache: false, success: function(text){ $(".adhtml").html(text); } }); }) </script> </div> </div> </div> </div> </div> </section> <!-- wap拉出按鈕 --> <div id="dnkpnhlp" class="site-tree-mobile layui-hide"> <i class="layui-icon layui-icon-spread-left"></i> </div> <!-- wap遮罩層 --> <div id="dnkpnhlp" class="site-mobile-shade"></div> <!--付費閱讀 --> <div class="dnkpnhlp" id="payread"> <div id="dnkpnhlp" class="layui-form-item">閱讀需要支付1元查看</div> <div id="dnkpnhlp" class="layui-form-item"><button class="btn-right">支付并查看</button></div> </div> <script> var prei=0; $(".site-seo-depict pre").each(function(){ var html=$(this).html().replace("<code>","").replace("</code>","").replace('<code class="javascript hljs" codemark="1">',''); $(this).attr('data-clipboard-text',html).attr("id","pre"+prei); $(this).html("").append("<code>"+html+"</code>"); prei++; }) $(".site-seo-depict img").each(function(){ if($(this).attr("src").indexOf('data:image/svg+xml')!= -1){ $(this).remove(); } }) $("LINK[href*='style-49037e4d27.css']").remove(); $("LINK[href*='markdown_views-d7a94ec6ab.css']").remove(); layui.use(['jquery', 'layer','code'], function(){ $("pre").attr("class","layui-code"); $("pre").attr("lay-title",""); $("pre").attr("lay-skin",""); layui.code(); $(".layui-code-h3 a").attr("class","copycode").html("復(fù)制代碼 ").attr("onclick","copycode(this)"); }); function copycode(target){ var id=$(target).parent().parent().attr("id"); var clipboard = new ClipboardJS("#"+id); clipboard.on('success', function(e) { e.clearSelection(); alert("復(fù)制成功") }); clipboard.on('error', function(e) { alert("復(fù)制失敗") }); } //$(".site-seo-depict").html($(".site-seo-depict").html().slice(0, -5)); </script> <link rel="stylesheet" type="text/css" href="http://www.ezyhdfw.cn/yun/static/js/neweditor/code/styles/tomorrow-night-eighties.css"> <script src="http://www.ezyhdfw.cn/yun/static/js/neweditor/code/highlight.pack.js" type="text/javascript"></script> <script src="http://www.ezyhdfw.cn/yun/static/js/clipboard.js"></script> <script>hljs.initHighlightingOnLoad();</script> <script> function setcode(){ var _html=''; document.querySelectorAll('pre code').forEach((block) => { var _tmptext=$.trim($(block).text()); if(_tmptext!=''){ _html=_html+_tmptext; console.log(_html); } }); } </script> <script> function payread(){ layer.open({ type: 1, title:"付費閱讀", shadeClose: true, content: $('#payread') }); } // 舉報 function jupao_tip(){ layer.open({ type: 1, title:false, shadeClose: true, content: $('#jubao') }); } $(".getcommentlist").click(function(){ var _id=$(this).attr("dataid"); var _tid=$(this).attr("datatid"); $("#articlecommentlist"+_id).toggleClass("hide"); var flag=$("#articlecommentlist"+_id).attr("dataflag"); if(flag==1){ flag=0; }else{ flag=1; //加載評論 loadarticlecommentlist(_id,_tid); } $("#articlecommentlist"+_id).attr("dataflag",flag); }) $(".add-comment-btn").click(function(){ var _id=$(this).attr("dataid"); $(".formcomment"+_id).toggleClass("hide"); }) $(".btn-sendartcomment").click(function(){ var _aid=$(this).attr("dataid"); var _tid=$(this).attr("datatid"); var _content=$.trim($(".commenttext"+_aid).val()); if(_content==''){ alert("評論內(nèi)容不能為空"); return false; } var touid=$("#btnsendcomment"+_aid).attr("touid"); if(touid==null){ touid=0; } addarticlecomment(_tid,_aid,_content,touid); }) $(".button_agree").click(function(){ var supportobj = $(this); var tid = $(this).attr("id"); $.ajax({ type: "GET", url:"http://www.ezyhdfw.cn/yun/index.php?topic/ajaxhassupport/" + tid, cache: false, success: function(hassupport){ if (hassupport != '1'){ $.ajax({ type: "GET", cache:false, url: "http://www.ezyhdfw.cn/yun/index.php?topic/ajaxaddsupport/" + tid, success: function(comments) { supportobj.find("span").html(comments+"人贊"); } }); }else{ alert("您已經(jīng)贊過"); } } }); }); function attenquestion(_tid,_rs){ $.ajax({ //提交數(shù)據(jù)的類型 POST GET type:"POST", //提交的網(wǎng)址 url:"http://www.ezyhdfw.cn/yun/favorite/topicadd.html", //提交的數(shù)據(jù) data:{tid:_tid,rs:_rs}, //返回數(shù)據(jù)的格式 datatype: "json",//"xml", "html", "script", "json", "jsonp", "text". //在請求之前調(diào)用的函數(shù) beforeSend:function(){}, //成功返回之后調(diào)用的函數(shù) success:function(data){ var data=eval("("+data+")"); console.log(data) if(data.code==2000){ layer.msg(data.msg,function(){ if(data.rs==1){ //取消收藏 $(".layui-layer-tips").attr("data-tips","收藏文章"); $(".layui-layer-tips").html('<i class="fa fa-heart-o"></i>'); } if(data.rs==0){ //收藏成功 $(".layui-layer-tips").attr("data-tips","已收藏文章"); $(".layui-layer-tips").html('<i class="fa fa-heart"></i>') } }) }else{ layer.msg(data.msg) } } , //調(diào)用執(zhí)行后調(diào)用的函數(shù) complete: function(XMLHttpRequest, textStatus){ postadopt=true; }, //調(diào)用出錯執(zhí)行的函數(shù) error: function(){ //請求出錯處理 postadopt=false; } }); } </script> <footer> <div id="dnkpnhlp" class="layui-container"> <div id="dnkpnhlp" class="flex_box_zd"> <div id="dnkpnhlp" class="left-footer"> <h6><a href="http://www.ezyhdfw.cn/"><img src="http://www.ezyhdfw.cn/yun/static/theme/ukd//images/logo.png" alt="UCloud (優(yōu)刻得科技股份有限公司)"></a></h6> <p>UCloud (優(yōu)刻得科技股份有限公司)是中立、安全的云計算服務(wù)平臺,堅持中立,不涉足客戶業(yè)務(wù)領(lǐng)域。公司自主研發(fā)IaaS、PaaS、大數(shù)據(jù)流通平臺、AI服務(wù)平臺等一系列云計算產(chǎn)品,并深入了解互聯(lián)網(wǎng)、傳統(tǒng)企業(yè)在不同場景下的業(yè)務(wù)需求,提供公有云、混合云、私有云、專有云在內(nèi)的綜合性行業(yè)解決方案。</p> </div> <div id="dnkpnhlp" class="right-footer layui-hidemd"> <ul class="flex_box_zd"> <li> <h6>UCloud與云服務(wù)</h6> <p><a href="http://www.ezyhdfw.cn/site/about/intro/">公司介紹</a></p> <p><a >加入我們</a></p> <p><a href="http://www.ezyhdfw.cn/site/ucan/onlineclass/">UCan線上公開課</a></p> <p><a href="http://www.ezyhdfw.cn/site/solutions.html" >行業(yè)解決方案</a></p> <p><a href="http://www.ezyhdfw.cn/site/pro-notice/">產(chǎn)品動態(tài)</a></p> </li> <li> <h6>友情鏈接</h6> <p><a >GPU算力平臺</a></p> <p><a >UCloud私有云</a></p> <p><a >SurferCloud</a></p> <p><a >工廠仿真軟件</a></p> <p><a >AI繪畫</a></p> <p><a >Wavespeed AI</a></p> </li> <li> <h6>社區(qū)欄目</h6> <p><a href="http://www.ezyhdfw.cn/yun/column/index.html">專欄文章</a></p> <p><a href="http://www.ezyhdfw.cn/yun/udata/">專題地圖</a></p> </li> <li> <h6>常見問題</h6> <p><a href="http://www.ezyhdfw.cn/site/ucsafe/notice.html" >安全中心</a></p> <p><a href="http://www.ezyhdfw.cn/site/about/news/recent/" >新聞動態(tài)</a></p> <p><a href="http://www.ezyhdfw.cn/site/about/news/report/">媒體動態(tài)</a></p> <p><a href="http://www.ezyhdfw.cn/site/cases.html">客戶案例</a></p> <p><a href="http://www.ezyhdfw.cn/site/notice/">公告</a></p> </li> <li> <span><img src="https://static.ucloud.cn/7a4b6983f4b94bcb97380adc5d073865.png" alt="優(yōu)刻得"></span> <p>掃掃了解更多</p></div> </div> <div id="dnkpnhlp" class="copyright">Copyright ? 2012-2025 UCloud 優(yōu)刻得科技股份有限公司<i>|</i><a rel="nofollow" >滬公網(wǎng)安備 31011002000058號</a><i>|</i><a rel="nofollow" ></a> 滬ICP備12020087號-3</a><i>|</i> <script type="text/javascript" src="https://gyfk12.kuaishang.cn/bs/ks.j?cI=197688&fI=125915" charset="utf-8"></script> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://#/hm.js?290c2650b305fc9fff0dbdcafe48b59d"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-DZSMXQ3P9N"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-DZSMXQ3P9N'); </script> <script> (function(){ var el = document.createElement("script"); el.src = "https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?99f50ea166557aed914eb4a66a7a70a4709cbb98a54ecb576877d99556fb4bfc3d72cd14f8a76432df3935ab77ec54f830517b3cb210f7fd334f50ccb772134a"; el.id = "ttzz"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(el, s); })(window) </script></div> </div> </footer> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.ezyhdfw.cn/" title="亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站 ">亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站 </a> <div class="friend-links"> </div> </div> </footer> <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body><div id="3r9hl" class="pl_css_ganrao" style="display: none;"><strong id="3r9hl"></strong><i id="3r9hl"><listing id="3r9hl"></listing></i><ol id="3r9hl"><optgroup id="3r9hl"><video id="3r9hl"><em id="3r9hl"></em></video></optgroup></ol><ins id="3r9hl"><address id="3r9hl"><strike id="3r9hl"><strong id="3r9hl"></strong></strike></address></ins><font id="3r9hl"><progress id="3r9hl"></progress></font><legend id="3r9hl"><acronym id="3r9hl"><label id="3r9hl"><th id="3r9hl"></th></label></acronym></legend><mark id="3r9hl"><thead id="3r9hl"><legend id="3r9hl"><acronym id="3r9hl"></acronym></legend></thead></mark><dfn id="3r9hl"></dfn><label id="3r9hl"></label><dl id="3r9hl"><pre id="3r9hl"></pre></dl><big id="3r9hl"><span id="3r9hl"><i id="3r9hl"><dfn id="3r9hl"></dfn></i></span></big><thead id="3r9hl"></thead><label id="3r9hl"><th id="3r9hl"></th></label><label id="3r9hl"><th id="3r9hl"></th></label><p id="3r9hl"><var id="3r9hl"><form id="3r9hl"><output id="3r9hl"></output></form></var></p><form id="3r9hl"><video id="3r9hl"><sub id="3r9hl"><div id="3r9hl"></div></sub></video></form><b id="3r9hl"><ins id="3r9hl"><address id="3r9hl"><strike id="3r9hl"></strike></address></ins></b><label id="3r9hl"><strong id="3r9hl"><rp id="3r9hl"><font id="3r9hl"></font></rp></strong></label><pre id="3r9hl"></pre><span id="3r9hl"></span><sub id="3r9hl"><div id="3r9hl"></div></sub><video id="3r9hl"><em id="3r9hl"></em></video><p id="3r9hl"><var id="3r9hl"><form id="3r9hl"><output id="3r9hl"></output></form></var></p><label id="3r9hl"><strong id="3r9hl"><rp id="3r9hl"><font id="3r9hl"></font></rp></strong></label><dl id="3r9hl"><i id="3r9hl"></i></dl><span id="3r9hl"><thead id="3r9hl"><dfn id="3r9hl"><strong id="3r9hl"></strong></dfn></thead></span><var id="3r9hl"><form id="3r9hl"></form></var><label id="3r9hl"></label><output id="3r9hl"><sub id="3r9hl"><div id="3r9hl"><ol id="3r9hl"></ol></div></sub></output><strong id="3r9hl"></strong><dfn id="3r9hl"><mark id="3r9hl"></mark></dfn><meter id="3r9hl"></meter><listing id="3r9hl"></listing><legend id="3r9hl"></legend><address id="3r9hl"><div id="3r9hl"><strong id="3r9hl"><pre id="3r9hl"></pre></strong></div></address><dl id="3r9hl"><i id="3r9hl"></i></dl><div id="3r9hl"></div><em id="3r9hl"></em><thead id="3r9hl"><legend id="3r9hl"></legend></thead><label id="3r9hl"><label id="3r9hl"><th id="3r9hl"><b id="3r9hl"></b></th></label></label><form id="3r9hl"><ins id="3r9hl"></ins></form><legend id="3r9hl"><dfn id="3r9hl"><u id="3r9hl"><ruby id="3r9hl"></ruby></u></dfn></legend><dl id="3r9hl"></dl><listing id="3r9hl"></listing><dfn id="3r9hl"><strong id="3r9hl"><rp id="3r9hl"><thead id="3r9hl"></thead></rp></strong></dfn><span id="3r9hl"><legend id="3r9hl"></legend></span><label id="3r9hl"></label><video id="3r9hl"><em id="3r9hl"></em></video><b id="3r9hl"><ins id="3r9hl"><pre id="3r9hl"><strike id="3r9hl"></strike></pre></ins></b><dfn id="3r9hl"><menuitem id="3r9hl"><span id="3r9hl"><thead id="3r9hl"></thead></span></menuitem></dfn></div> <script src="http://www.ezyhdfw.cn/yun/static/theme/ukd/js/common.js"></script> <<script type="text/javascript"> $(".site-seo-depict *,.site-content-answer-body *,.site-body-depict *").css("max-width","100%"); </script> </html>