鍍金池/ 問答/ HTML問答
乞許 回答

你這個邏輯有點(diǎn)復(fù)雜 歸根結(jié)底是判斷用戶是否在某個時間段內(nèi)
所以反過來判斷 先找出用戶的時間段 然后根據(jù)當(dāng)前時間戳判斷

var username = "aaa";
function inTimeSlot(arr,username){
    var timestamp = Date.parse(new Date());//js獲取的都是到毫秒 我看你的數(shù)據(jù)是10位,這個要把后三位截掉
    for(var i=0;i<arr.length;i++){
            for(var j=0;arr[i].user_list.length;j++){
                if(username==arr[i].user_list[j].user.username){//找到用戶在那個時間段內(nèi)
                    if(timestamp>=arr[i].start_at&&timestamp<=arr[i].end_at){
                        return {in_now_time:true,data:arr[i]} //在當(dāng)前時間段內(nèi)
                    }else{
                        return {in_now_time:false,data:arr[i]}//不在當(dāng)前時間段內(nèi)
                       }
                }
            }
        }
    }
}
念舊 回答

menuItemsArray默認(rèn)值是null吧

querySelectorAll轉(zhuǎn)成數(shù)組應(yīng)該不會是null

鹿惑 回答
  1. 只需要 clone 部分版本
  2. 有一部分,但不需要全部
孤星 回答

antd-Tabs
我看了下antd的Tabs可以做到,選擇卡片式,樣式是一樣的,而且可關(guān)閉

不討囍 回答

spring mvc上傳文件的時候,你需要在spring mvc配置文件中配置org.springframework.web.multipart.commons.CommonsMultipartResolver文件上傳解析器。

1:當(dāng)一個請求過來的時候,會調(diào)用DispatcherServlet類中的doDispatch(HttpServletRequest, HttpServletResponse)方法。

doDispatch方法體

protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception {
        HttpServletRequest processedRequest = request;
        HandlerExecutionChain mappedHandler = null;
        boolean multipartRequestParsed = false;

        WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);

        try {
            ModelAndView mv = null;
            Exception dispatchException = null;

            try {
                processedRequest = checkMultipart(request);
                multipartRequestParsed = processedRequest != request;

                // Determine handler for the current request.
                mappedHandler = getHandler(processedRequest, false);
                if (mappedHandler == null || mappedHandler.getHandler() == null) {
                    noHandlerFound(processedRequest, response);
                    return;
                }

                // Determine handler adapter for the current request.
                HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());

                // Process last-modified header, if supported by the handler.
                String method = request.getMethod();
                boolean isGet = "GET".equals(method);
                if (isGet || "HEAD".equals(method)) {
                    long lastModified = ha.getLastModified(request, mappedHandler.getHandler());
                    if (logger.isDebugEnabled()) {
                        String requestUri = urlPathHelper.getRequestUri(request);
                        logger.debug("Last-Modified value for [" + requestUri + "] is: " + lastModified);
                    }
                    if (new ServletWebRequest(request, response).checkNotModified(lastModified) && isGet) {
                        return;
                    }
                }

                if (!mappedHandler.applyPreHandle(processedRequest, response)) {
                    return;
                }

                try {
                    // Actually invoke the handler.
                    mv = ha.handle(processedRequest, response, mappedHandler.getHandler());
                }
                finally {
                    if (asyncManager.isConcurrentHandlingStarted()) {
                        return;
                    }
                }

                applyDefaultViewName(request, mv);
                mappedHandler.applyPostHandle(processedRequest, response, mv);
            }
            catch (Exception ex) {
                dispatchException = ex;
            }
            processDispatchResult(processedRequest, response, mappedHandler, mv, dispatchException);
        }
        catch (Exception ex) {
            triggerAfterCompletion(processedRequest, response, mappedHandler, ex);
        }
        catch (Error err) {
            triggerAfterCompletionWithError(processedRequest, response, mappedHandler, err);
        }
        finally {
            if (asyncManager.isConcurrentHandlingStarted()) {
                // Instead of postHandle and afterCompletion
                mappedHandler.applyAfterConcurrentHandlingStarted(processedRequest, response);
                return;
            }
            // Clean up any resources used by a multipart request.
            if (multipartRequestParsed) {
                cleanupMultipart(processedRequest);
            }
        }
    }

2:在doDispatch方法體中調(diào)用checkMultipart(request)方法判斷是否是文件上傳的請求,判斷是根據(jù)Content-type來的,如果是文件上傳的請求,在checkMultipart(request)方法中就會調(diào)用在CommonsMultipartResolver中的方法進(jìn)行文件解析(實(shí)際是調(diào)用apache commons-fileupload的文件長傳插件),解析完成后,其實(shí)文件已經(jīng)上傳到服務(wù)器本地磁盤了,請看下面的代碼片段。

protected HttpServletRequest checkMultipart(HttpServletRequest request) throws MultipartException {
        if (this.multipartResolver != null && this.multipartResolver.isMultipart(request)) {
            if (request instanceof MultipartHttpServletRequest) {
                logger.debug("Request is already a MultipartHttpServletRequest - if not in a forward, " +
                        "this typically results from an additional MultipartFilter in web.xml");
            }
            else {
                return this.multipartResolver.resolveMultipart(request);
            }
        }
        // If not returned before: return original request.
        return request;
    }

在checkMultipart方法體中調(diào)用了CommonsMultipartResolver類的resolveMultipart方法去解析文件,該方法返回的是MultipartHttpServletRequest對象,該對象中存有已經(jīng)上傳的服務(wù)器本地的文件對象。

3:獲取具體處理器的方法(mv = ha.handle(processedRequest, response, mappedHandler.getHandler()) 這行代碼)。
如果是文件上傳的話,processedRequest是上面的checkMultipart方法返回的對象。

實(shí)際調(diào)用的org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter類的handle方法,該方法中獲取實(shí)際被調(diào)用的方法參數(shù)上有哪些注解,然后根據(jù)注解的一些配置,從processedRequest獲取對應(yīng)的值。

比如你上面的testUpload()方法。在AnnotationMethodHandlerAdapter的handle()的方法中會獲取testUpload()的方法參數(shù)有@RequestParam這個注解,然后解析這個注解,從processedRequest請求中獲取到desc的值,獲取到名為file的文件,最后調(diào)用testUploaad()方法。具體是怎么解析的可以看看org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(Method, Object, NativeWebRequest, ExtendedModelMap)這個方法體。

愛是癌 回答

魅族手機(jī)keycode好像拿到的都是0 什么情況

膽怯 回答

:current-page.sync="currentPage" 這個綁定的屬性是什么意思

短嘆 回答

fs是nodejs自身的文件模塊,并不需要其他方式的安裝。
lz這個情況挺神奇的。。用root權(quán)限跑一下npm run dev試試?;蚴侵匮b下node。

久不遇 回答

你這個好像沒做預(yù)加載吧(看代碼是直接寫頁面?)……沒做預(yù)加載肯定沒戲的,瀏覽器不會允許你突然冒這么大一個東西直接放的。

按說一般H5產(chǎn)品思路是把這個觸發(fā)放到預(yù)加載的結(jié)束提示上,這樣不會太突兀,也比較符合用戶習(xí)慣。

巴扎嘿 回答

不要設(shè)置高度。。。。

尐懶貓 回答

上面的swiper在哪呢?
沒用過這個組件,但是組件總對外有事件暴露吧,比如sliderChangeEnd(滑動結(jié)束)什么的?
一個組件的滑動結(jié)束之后或者被點(diǎn)擊時,去調(diào)用另一個組件的滑動方法或者修改控制狀態(tài)的props的值就好了呀。

圖片node的lastUpdate用的是UTC時間,轉(zhuǎn)換實(shí)際時間要加時區(qū)。

夕顏 回答

http.ServerResponse 類
1.如果writeHead之后想要繼續(xù)返回內(nèi)容,應(yīng)該調(diào)用write/end方法。
2.cookie是在第一次服務(wù)器響應(yīng)后在客戶端設(shè)置的,所以第二次客戶端的請求才會攜帶cookie(個人理解)

夢若殤 回答

這個屬于 div 橫向滑動問題

你百度一下有很多例子可以參考

搞了個大烏龍。遞歸組件的父組件中sectionList也是異步獲取的,未等到sectionList數(shù)據(jù)獲取完畢,遞歸組件已經(jīng)mounted了,此時遞歸組件獲取到一個長度為零的sectionList,并沒有發(fā)起獲取details的請求,就更沒有details的數(shù)據(jù)了。然后其實(shí)并不關(guān)v-show的事,只是粗心,父組件獲取的到的sectionList數(shù)據(jù)是一個嵌套的樹形數(shù)據(jù),我在父組件遍歷了一遍只給第一層數(shù)據(jù)設(shè)置了show屬性,更深層次的結(jié)構(gòu)沒有show屬性而導(dǎo)致v-show的判斷并不生效(深層的details數(shù)據(jù)已經(jīng)獲取到)但一直不會顯示出來,看到第一層沒有數(shù)據(jù)誤以為深層也是沒有數(shù)據(jù)。

柒喵 回答

兄弟,這和webpack有半毛錢關(guān)系,你是后臺數(shù)據(jù)怎么靜態(tài)化?而且dede也不是靜態(tài)化,他只不過不是用的接口,類型jsp那種形式,就是后臺和前端耦合。我覺得你應(yīng)該這樣,把你寫好的頁面(靜態(tài)頁面)給你們后臺,然后讓他把數(shù)據(jù)放進(jìn)去(不要使用ajax,axios形式)。

萢萢糖 回答
方法很多,隨便列一個,也不一定可以
grep 'UNIVER_SEARCH_VIDEO' example.ini >> /etc/profile
...

source /etc/profile
紓惘 回答

先安裝依賴 npm install ip

代碼里面添加
const ip = require('ip');
const IPAddress = ip.address();
console.log(IPAddress);