在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ HTML5問答
獨白 回答

由于那個nav1的父盒子是固定定位了的,沒有設(shè)定高度,高度默認就和內(nèi)容高度相同了,而使用padding之后,拖沒內(nèi)容,它也是有高的,高度的計算你應該知道是怎么一回事。

這種情況就不要使用padding了,用定位來解決。或者使用事件來動態(tài)更改padding的值。
爆扎 回答

這樣的話,可以嘗試Ctrl+Shfit+n打開隱身模式的Tab再進行調(diào)試,至少可以過濾掉chrome擴展的腳本

撿肥皂 回答

利用正則工具MTracer ^d+$ 可以匹配多個正整數(shù)
圖片描述
因此,替換一下正則表達式即可
oninput="this.value=this.value.replace(/^d+$/,'')"

貓小柒 回答

如果是同步的話,碰到開發(fā)者高頻率調(diào)用setState方法,比如在一個回調(diào)函數(shù)中調(diào)用多個函數(shù),每個函數(shù)都調(diào)用一次setState,React會頻繁渲染,性能和體驗都很差,所以采用了異步更新的方式,將數(shù)次變動集中起來更新。

避免這個異步更新問題的方法有兩種,一是采用樓上說的回調(diào)函數(shù),二是setState傳入一個函數(shù),如下

this.setState(prevState=>({
    ...prevState,
    [propYouWantToChange]:valueYouWantToChange
}))

這個prevState每次都是新的,前提是在之前你沒有通過setState({})的方式改變過相關(guān)的屬性

悶油瓶 回答

這些基本都是模塊化方案,實際上自己頁很容易寫出模塊化的原理
webpack

(function(modulesArr) {
    var rootModule = {};
    function __require__(id) {
        if (rootModule[id]) {
            return rootModule[id].exports;
        }
        var currentModule = modulesArr[id];
        var module = {
            id,
            exports: {}
        };
        currentModule.call(module.exports, module.exports, module, __require__);
        currentModule[id] = module;
        return module.exports;
    }
    return __require__(0);
})([
    function(exports, module, require) {
        var m1 = require(1);
        console.log(m1);
    },
    function(exports, module, require) {
        exports.msg = 'Hello World';
        var m2 = require(2);
        m2();
    },
    function(exports, module, require) {
        module.exports = function() {
            var str = 'Hello World';
            console.log(str);
            return str;
        };
    }
]);

我自己實現(xiàn)的browser端模塊化

(function(global) {
    'use strict';
    var errMsg = Math.random().toString(32).substr(2);
    var rootModule = {};
    function ModuleCtor(id) {
        if (!this || this.__proto__ !== ModuleCtor.prototype) {
            return new ModuleCtor(id);
        }
        this.id = id;
        this.exports = {};
        this.loaded = !1;
    }

    function define(id, fn) {
        if (typeof id === 'function') {
            fn = id;
            id = document.currentScript
                ? document.currentScript.src
                : Math.random()
                      .toString(32)
                      .substr(2);
        }
        if (typeof id !== 'string') {
            id = '' + id;
        }
        var module = ModuleCtor(id);
        exec();
        function __require__(src) {
            if (rootModule[src] && rootModule[src].__proto__ === ModuleCtor.prototype) {
                return rootModule[src].exports;
            }
            loadScript(src, function() {
                exec();
            });
            throw new Error(errMsg);
        }
        function exec() {
            try {
                fn.call(module.exports, module.exports, module, __require__);
                module.loaded = !0;
                rootModule[id] = module;
            } catch (err) {
                if (err.message !== errMsg) {
                    throw err;
                }
            }
        }
    }

    function loadScript(src, callback) {
        var script = document.createElement('script');
        script.src = src;
        script.onload = function() {
            callback && callback(src);
        };
        document.body.appendChild(script);
        return script;
    }
    global.define = define;
})(window);

本質(zhì)都是js沒有模塊,所以我們就想到全局暴露一個rootModule對象,每一個鍵都是一個模塊,exports對象是依賴的暴露。
如a.js

    module.exports = 'Hello World';

b.js

    var chars = require('./a');
    process.stdout.write(chars + '\n'); // Hello World

但是我們怎么實現(xiàn)呢,(一)編譯:如webpack,(二)暴露一個函數(shù),如requirejs、seajs。


webpack 可以配置 output libraryTarget: 'umd', library: 'globalVarName' 打題主說的這種umd包,兼容瀏覽器,requirejs,node環(huán)境。


另外我還是忍不住吐槽一下seajs的垃圾,一個文件的多個require發(fā)請求時沒有順序之分,字符串正則來分析依賴。。。如果jQuery的plugin依賴jQuery,需要對jQueryplugin改一下代碼討個套個客,不能直接想requirejs直接在config中聲明依賴。垃圾。當然我自己寫的模塊加載更垃圾,連依賴都不分析。多try幾次必然成功。

黑與白 回答

canvas上畫的球 你肯定能獲取到球的圓心坐標,只需要判斷你鼠標點擊的點和圓心的距離, 是否小于半徑,小于半徑就說明在圓內(nèi) 就可以出發(fā)點擊事件

過客 回答

float 會脫離文檔流,相當于飛起來了 :) 可以嘗試用 border-right

孤島 回答

browserSync 很便捷的一個小插件,
配合vConsole可以實現(xiàn)實時刷新和在手機上調(diào)試

淡墨 回答

展示時后臺給的id不需要用,直接把name提取出來組成數(shù)組,然后選中的選項,根據(jù)value作為下標對應到后臺的id就可以了。需要前臺稍微寫點代碼的,并不麻煩。

痞性 回答

這個是隊列,一次一個。

笑忘初 回答

arr.toString===Array.prototype.toString
true

因為這個是數(shù)組啊。。。你可以認為數(shù)組繼承了對象的原型鏈但是對某些函數(shù)進行了改寫,那么自然就不能相對了。同理,你對一個對象tostring跟一個數(shù)組tostring能一樣嗎

獨白 回答

其實用svg實現(xiàn)最好,
但如果最簡單只用css也可以

<div id="test">
    <div id="box">88%</div>
</div>
#test{
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: red;
    background-image: linear-gradient(54deg, red 50%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0)), linear-gradient(270deg, red 50%, #fff 50%, #fff);//關(guān)鍵代碼
}
#box{
    position: absolute;
    width: 90px;
    height: 90px;
    top: 5px;
    left: 5px;
    background-color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 90px;
    font-size: 16px;
}
柒槿年 回答

這個input標簽android端實現(xiàn)邏輯為瀏覽器自定義的,瀏覽器如果沒有實現(xiàn)無法兼容,很多瀏覽器沒有去實現(xiàn),不存在可以兼容的情況。

萢萢糖 回答

data() 中是取不到 computed 的值的,因為 computed 依賴于 data

created() 中 data 和 computed 就都已經(jīng)準備好了,所以你可以在 created 里手動給它賦值:

created () {
  this.selectValue = this.SINGLE_GAME
}
負我心 回答

打開瀏覽器控制臺觀察就能發(fā)現(xiàn)了,滾動時改變樣式opacity

乖乖瀦 回答

width的默認單位是px吧,你是想要100%嗎

醉淸風 回答

npm install -g vue-cli@版本號


查看版本號

vue -V
只愛你 回答

自己解決了其實就是

//注釋
var ul = parent.find('ul:visible').slideUp(animationSpeed);
ul.removeClass('menu-open');

//注釋 removeClass("avtive")
parent.find('li.active').removeClass('');

代碼如下:
$.AdminLTE.tree = function (menu) {

var _this = this;
var animationSpeed = $.AdminLTE.options.animationSpeed;
$(document).off('click', menu + ' li a')
  .on('click', menu + ' li a', function (e) {
    //Get the clicked link and the next element
    var $this = $(this);
    var checkElement = $this.next();

    //Check if the next element is a menu and is visible
    if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible')) && (!$('body').hasClass('sidebar-collapse'))) {
      //Close the menu
      checkElement.slideUp(animationSpeed, function () {
        checkElement.removeClass('menu-open');            
        //Fix the layout in case the sidebar stretches over the height of the window
        // _this.layout.fix();
      });          
      checkElement.parent("li").removeClass("active");       
    }
    //If the menu is not visible
    else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
      //Get the parent menu
      var parent = $this.parents('ul').first();
      //Close all open menus within the parent
      // var ul = parent.find('ul:visible').slideUp(animationSpeed);
      //Remove the menu-open class from the parent
      // ul.removeClass('menu-open');
      //Get the parent li
      var parent_li = $this.parent("li");

      //Open the target menu and add the menu-open class
      checkElement.slideDown(animationSpeed, function () {
        //Add the class active to the parent li
        checkElement.addClass('menu-open');            
        parent.find('li.active').removeClass('');
        parent_li.addClass('active');
        //Fix the layout in case the sidebar stretches over the height of the window
        _this.layout.fix();
      });
    }
    //if this isn't a link, prevent the page from being redirected
    if (checkElement.is('.treeview-menu')) {
      e.preventDefault();          
    }
  });

};