主頁 > 作業系統 > javascriptquiz如何給答案陣列一個默認值?

javascriptquiz如何給答案陣列一個默認值?

2022-01-18 01:05:39 作業系統

我正在創建一個需要回答每個答案的測驗。問題是如果您沒有答案,您應該能夠跳過問題。每次按下一步時,我都會嘗試設定默認答案,因此當我嘗試跳過一個時,我不必回答它即可獲得價值。我想要的默認值是每次我陣列的最后一個值。

下一個和上一個問題

        SetQuestion(question) {

            if (this.questionNumber >= 0) {
                let oldAnswerButton = document.querySelectorAll('.filter_anwser');

                // Deletes old question when the next question is clicked
                for (let answerButton of oldAnswerButton) {
                    answerButton.style.display = 'none';
                }
            }

            this.questionNumber = question;

            let q = this.quiz[question];
            // Check if your at the last question so the next button will stop being displayed.
            if (this.questionNumber === Quiz.length - 1) {
                this.nextbtn.style.display = 'none';
                this.prevbtn.style.display = 'block';
                this.resultbtn.style.display = 'grid';
            } else if (this.questionNumber === 0) {
                this.nextbtn.style.display = 'block';
                this.prevbtn.style.display = 'none';
                this.resultbtn.style.display = 'none';
            } else {
                this.nextbtn.style.display = 'block';
                this.prevbtn.style.display = 'block';
                this.resultbtn.style.display = 'none';
            }

            // Displays Question
            this.questionName.textContent = q.questionText;
            this.questionName.id = "questionID";

            return q;
            console.log(this.getLink())
            console.log(this.tmp)

        }

        IntoArray() {
            const UrlVar = new URLSearchParams(this.getLink())
            this.UrlArray = [...UrlVar.entries()].map(([key, values]) => (
                    {[key]: values.split(",")}
                )
            );
        }

        NextQuestion() {
            // let quizUrl = this.url[this.questionNumber];
            let question = this.SetQuestion(this.questionNumber   1);
            let pre = question.prefix;
            let prefixEqual = pre.replace('=', '');
            let UrlArr = this.UrlArray;
            let UrlKeys = UrlArr.flatMap(Object.keys)
            let answers = question.chosenAnswer.slice(0, -1);

            this.clicked = true;

            // Displays answers of the questions
            for (let y = 0; y < answers.length; y  ) {
                let item = answers[y];

                // Display answer buttons
                if (UrlKeys.includes(prefixEqual)) { 
                    console.log("exists");
                    let btn = document.querySelector('button[value="'   item.id   '"]');
                    btn.style.display = 'block';
                } else {
                    let btn = document.createElement('button');
                    btn.value = item.id;
                    btn.classList.add("filter_anwser", pre)
                    btn.id = 'answerbtn';
                    btn.textContent = item.name;
                    this.button.appendChild(btn);
                }

                // let quizUrl = control.url[control.questionNumber];
                // // console.log(this.tmp);
                // if (quizUrl === undefined) {
                //     quizUrl.push(question.prefix[y]   '');
                // }

                // if (quizUrl === undefined){
                //     this.tmp.push('');
                // }
            }


            this.IntoArray();
        }

        PrevQuestion() {
            let question = this.SetQuestion(this.questionNumber - 1);
            let answers = question.chosenAnswer.slice(0, -1);

            // Displays answers of the questions
            for (let y = 0; y < answers.length; y  ) {
                let item = answers[y];

                // Display answer buttons
                let btn = document.querySelector('button[value="'   item.id   '"]');
                btn.style.display = 'block';
            }
            this.IntoArray();
        }

鏈接創建者:

        /**
         * Returns the parameters for the URL.
         *
         * @returns {string}
         */
        getLink() {
            this.tmp = [];
            for (let i = 0; i < this.url.length; i  ) {
                // Check if question is from the same quiz part and adds a , between chosen answers and add the right prefix at the beginning
                if (this.url[i].length > 0) {
                    this.tmp.push(""   Quiz[i].prefix   this.url[i].join(","))
                    // console.log(this.url)
                }
                if (this.url[i].length === 0) {
                    this.tmp.push("");
                }
            }
            /// If answers are from different quiz parts add a & between answers.
            return ""   this.tmp.join("&");
            // console.log(this.url[i].prefix);
        };

回答點擊事件

    control.button.addEventListener("click", function (e) {
        const tgt = e.target;
        control.clicked = true;

        // clear the url array if there's nothing clicked
        if (control.url.length === control.questionNumber) {
            control.url.push([]);
        }

        let quizUrl = control.url[control.questionNumber];

        // Check if a button is clicked. Changes color and adds value to the url array.
        if (quizUrl.indexOf(tgt.value) === -1) {
            quizUrl.push(tgt.value);
            e.target.style.backgroundColor = "orange";
            // Check if a button is clicked again. If clicked again changes color back and deletes value in the url array.
        } else {
            quizUrl.splice(quizUrl.indexOf(tgt.value), 1);
            e.target.style.backgroundColor = "white";
        }

        console.log(control.getLink());
        console.log(quizUrl)

    })

大批:

    class QuizPart {
        constructor(questionText, chosenAnswer, prefix, questionDescription) {
            this.questionText = questionText;
            this.chosenAnswer = chosenAnswer;
            this.prefix = prefix;
            this.questionDescription = questionDescription;
        }
    }

    class ChosenAnswer {
        constructor(id, name) {
            this.id = id;
            this.name = name;
        }
    }

    let Quiz = [
        new QuizPart('Whats your size?', [
                new ChosenAnswer('6595', '41'),
                new ChosenAnswer('6598', '42'),
                new ChosenAnswer('6601', '43'),
                new ChosenAnswer('', ''),
            ], 'bd_shoe_size_ids=',
            'The size of your shoes is very important. If you have the wrong size, they wont fit.'),

        new QuizPart('What color would you like?', [
                new ChosenAnswer('6053', 'Red'),
                new ChosenAnswer('6044', 'Blue'),
                new ChosenAnswer('6056', 'Yellow'),
                new ChosenAnswer('6048', 'Green'),
                new ChosenAnswer('', ''),
            ], 'color_ids=',
            'Color isn t that important, It looks good tho.'),

        new QuizPart('What brand would you like?', [
                new ChosenAnswer('5805', 'Adidas'),
                new ChosenAnswer('5866', 'Nike'),
                new ChosenAnswer('5875', 'Puma'),
                new ChosenAnswer('', ''),
            ], 'manufacturer_ids=',
            'Brand is less important. Its just your own preference'),
    ]

我嘗試為陣列的鏈接創建者和我的事件監聽器提供一個默認值,并在我從我的一個按鈕獲得實際值時替換它,但它只是不起作用。有誰能夠幫我?

uj5u.com熱心網友回復:

我知道,這可能與您對答案的期望相差甚遠——但是您為什么不看看像 Vue 這樣的反應式工具呢?它具有執行此類任務可能需要的所有工具,甚至更多:

  • 整個測驗可以抽象為一個簡單的物件陣列(問題)
  • next, prev,設定默認答案變得輕而易舉
  • 易于擴展(有問題)
  • 易于更新(模板、功能等)

Vue.component('QuizQuestion', {
  props: ['data', 'selected'],
  computed: {
    valSelected: {
      get() {
        return this.selected
      },
      set(val) {
        this.$emit('update:selected', val)
      }
    },
  },
  template: `
    <div>
      {{ data.text }}<br />
      {{ data.description }}<br />
      <div >
        <label
          v-for="val in data.options"
          :key="val[0]"
        >
          <input
            type="radio"
            :name="data.text"
            :value="val"
            v-model="valSelected"
          />
          {{ val[1] }}
        </label>
      </div>
    </div>
  `
})
new Vue({
  el: "#app",
  computed: {
    currentQuestion() {
      return this.questions[this.current]
    },
    hasPrev() {
      return !!this.current
    },
    hasNext() {
      return this.current < this.questions.length - 1
    },
  },
  data() {
    return {
      current: 0,
      questions: [{
        text: 'Whats your size?',
        description: 'The size of your shoes is very important. If you have the wrong size, they wont fit.',
        options: [
          ['6595', '41'],
          ['6598', '42'],
          ['6601', '43'],
          ['', ''],
        ],
        selected: null,
      }, {
        text: 'What color would you like?',
        description: 'Color isn\'t that important, It looks good tho.',
        options: [
          ['6053', 'Red'],
          ['6044', 'Blue'],
          ['6056', 'Yellow'],
          ['6048', 'Green'],
          ['', ''],
        ],
        selected: null,
      }, {
        text: 'What brand would you like?',
        description: 'Brand is less important. Its just your own preference',
        options: [
          ['5805', 'Adidas'],
          ['5866', 'Nike'],
          ['5875', 'Puma'],
          ['', ''],
        ],
        selected: null,
      }, ],
    }
  },
  methods: {
    selectDefault() {
      this.questions[this.current] = {
        ...this.questions[this.current],
        selected: this.questions[this.current].options.slice(-1)[0],
      }
    },
    getPrev() {
      if (this.hasPrev) {
        if (!this.currentQuestion.selected) {
          this.selectDefault()
        }
        this.current -= 1
      }
    },
    getNext() {
      if (this.hasNext) {
        if (!this.currentQuestion.selected) {
          this.selectDefault()
        }
        this.current  = 1
      }
    },
  },
  template: `
    <div>
      <quiz-question
        :data="currentQuestion"
        :selected.sync="currentQuestion.selected"
      /><br />
      <button v-if="hasPrev" @click="getPrev">PREV</button>
      <button v-if="hasNext" @click="getNext">NEXT</button>
      <button v-if="!hasNext">RESULT</button>
    </div>
  `
})
.quiz-options {
  display: flex;
  flex-direction: column;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app"></div>

編輯

但是,如果不使用框架/庫,這里有一個更面向物件的方法:

class Quiz {
  constructor(questions) {
    this._current = 0
    this._questions = questions
  }
  get current() {
    return this._current
  }
  set current(val) {
    this._current = val
  }
  get hasNext() {
    return this.current < this.questions.length - 1
  }
  get hasPrev() {
    return !!this.current
  }
  get questions() {
    return this._questions
  }
  get next() {
    this.current = this.hasNext ? this.current   1 : this.current
    return this.currentQuestion
  }
  get prev() {
    this.current = this.hasPrev ? this.current - 1 : this.current
    return this.currentQuestion
  }
  get currentQuestion() {
    return this.questions[this.current]
  }
}

class Question {
  constructor({
    text,
    description,
    options,
    prefix,
  }) {
    this.text = text
    this.desc = description
    this.prefix = prefix
    this._options = options.map(([key, val]) => ({
      id: key,
      value: [key, val],
      selected: false,
    }))
  }
  get options() {
    return this._options
  }
  set options(newOptions) {
    this._options = newOptions
  }
  get selected() {
    return this.options.find(({
      selected
    }) => !!selected)
  }
  set selected(selectedVal) {
    this.options = [...this.options.map(({
      value: [key, val],
      selected,
      ...rest
    }) => {
      return {
        ...rest,
        value: [key, val],
        selected: key === selectedVal
      }
    })]
  }
  get lastOption() {
    return this.options.slice(-1)[0]
  }
  setDefault() {
    if (!this.selected) {
      this.selected = this.lastOption.id
    }
  }
}

const urlParser = (quiz) => {
  return quiz.questions.map(({
    prefix,
    selected = {
      value: ['']
    }
  }) => {
    const s = selected.value[0] ? selected.value[0] : ''
    return `${prefix}${s}`
  }).join('&')
}

const qArr = [{
    text: 'text1',
    description: 'desc1',
    options: [
      ['1_1', '11'],
      ['1_2', '12'],
      ['1_3', '13'],
    ],
    prefix: 'prefix_1_',
  },
  {
    text: 'text2',
    description: 'desc2',
    options: [
      ['2_1', '21'],
      ['2_2', '22'],
      ['2_3', '23'],
    ],
    prefix: 'prefix_2_',
  },
  {
    text: 'text3',
    description: 'desc3',
    options: [
      ['3_1', '31'],
      ['3_2', '32'],
      ['3_3', '33'],
    ],
    prefix: 'prefix_3_',
  },
]

const getOptionsHtml = ({
  text,
  options
}) => {
  let html = ''
  options.forEach(({
    id,
    value,
    selected
  }, i) => {
    html  = `
        <label>
        <input
            
            type="radio"
          name="${text}"
          value="${value[0]}"
          ${selected ? 'checked' : ''}
        />
        ${value[1]}
      </label>
    `
  })
  return html
}

const getSingleQuestionHtml = (q) => {
  const optionsHtml = getOptionsHtml({
    text: q.text,
    options: q.options
  })
  return `
    ${q.text}<br />
    ${q.desc}<br />
    ${optionsHtml}
  `
}

const registerEventHandlers = ({
  container,
  question
}) => {
  const radioBtns = document.querySelectorAll('.question-input')
  radioBtns.forEach((input, i) => {
    input.addEventListener('change', function(e) {
      question.selected = e.target.value
    })
  })
}

const updateHtml = ({
  container,
  question
}) => {
  container.innerHTML = getSingleQuestionHtml(question)
  registerEventHandlers({
    container,
    question
  })
};

const updateContainer = (container) => (question) => updateHtml({
  container,
  question
});

const setElDisplay = ({
  el,
  display
}) => {
  if (display) {
    el.classList.add("d-inline-block")
    el.classList.remove("d-none")
  } else {
    el.classList.remove("d-inline-block")
    el.classList.add("d-none")
  }
}

const updateBtnVisibility = ({
  btnNext,
  btnPrev,
  btnResult,
  quiz
}) => () => {
  setElDisplay({
    el: btnNext,
    display: quiz.hasNext
  })
  setElDisplay({
    el: btnResult,
    display: !quiz.hasNext
  })
  setElDisplay({
    el: btnPrev,
    display: quiz.hasPrev
  })
}

(function() {
  const quiz = new Quiz(qArr.map(q => new Question(q)))

  const container = document.getElementById('quiz-container')
  updateQuizContainer = updateContainer(container)
  updateQuizContainer(quiz.currentQuestion)

  const btnPrev = document.getElementById('btn-prev')
  const btnNext = document.getElementById('btn-next')
  const btnResult = document.getElementById('btn-result')

  const updateBtns = updateBtnVisibility({
    btnPrev,
    btnNext,
    btnResult,
    quiz
  })
  updateBtns()

  btnPrev.addEventListener('click', function() {
    if (quiz.hasPrev) {
      quiz.currentQuestion.setDefault()
    }
    updateQuizContainer(quiz.prev)
    updateBtns()
  })
  btnNext.addEventListener('click', () => {
    if (quiz.hasNext) {
      quiz.currentQuestion.setDefault()
    }
    updateQuizContainer(quiz.next)
    updateBtns()
  })
  btnResult.addEventListener('click', function() {
    quiz.currentQuestion.setDefault()
    console.log(urlParser(quiz))
  })
})();
.d-inline-block {
  display: inline-block;
}

.d-none {
  display: none;
}
<div id="quiz-container"></div>
<div id="quiz-controls">
  <button id="btn-prev" class="d-inline-block">
    PREV
  </button>
  <button id="btn-next" class="d-inline-block">
    NEXT
  </button>
  <button id="btn-result" class="d-none">
    RESULT
  </button>
</div>
<div id="result"></div>

轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/413837.html

標籤:

上一篇:我的代碼有效,但它與解決方案有很大不同?

下一篇:替換BaseR中lm()函式的部分輸出

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • CA和證書

    1、在 CentOS7 中使用 gpg 創建 RSA 非對稱密鑰對 gpg --gen-key #Centos上生成公鑰/密鑰對(存放在家目錄.gnupg/) 2、將 CentOS7 匯出的公鑰,拷貝到 CentOS8 中,在 CentOS8 中使用 CentOS7 的公鑰加密一個檔案 gpg -a ......

    uj5u.com 2020-09-10 00:09:53 more
  • Kubernetes K8S之資源控制器Job和CronJob詳解

    Kubernetes的資源控制器Job和CronJob詳解與示例 ......

    uj5u.com 2020-09-10 00:10:45 more
  • VMware下安裝CentOS

    VMware下安裝CentOS 一、軟硬體準備 1 Centos鏡像準備 1.1 CentOS鏡像下載地址 下載地址 1.2 CentOS鏡像下載程序 點擊下載地址進入如下圖的網站,選擇需要下載的版本,這里選擇的是Centos8,點擊如圖所示。 決定選擇Centos8后,選擇想要的鏡像源進行下載,此 ......

    uj5u.com 2020-09-10 00:12:10 more
  • 如何使用Grep命令查找多個字串

    如何使用Grep 命令查找多個字串 大家好,我是良許! 今天向大家介紹一個非常有用的技巧,那就是使用 grep 命令查找多個字串。 簡單介紹一下,grep 命令可以理解為是一個功能強大的命令列工具,可以用它在一個或多個輸入檔案中搜索與正則運算式相匹配的文本,然后再將每個匹配的文本用標準輸出的格式 ......

    uj5u.com 2020-09-10 00:12:28 more
  • git配置http代理

    git配置http代理 經常遇到克隆 github 慢的問題,這里記錄一下幾種配置 git 代理的方法,解決 clone github 過慢。 目錄 git配置代理 git單獨配置github代理 git配置全域代理 配置終端環境變數 git配置代理 主要使用 git config 命令 git單獨 ......

    uj5u.com 2020-09-10 00:12:33 more
  • Linux npm install 裝包時提示Error EACCES permission denied解

    npm install 裝包時提示Error EACCES permission denied解決辦法 ......

    uj5u.com 2020-09-10 00:12:53 more
  • Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包

    Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包。 18 (flaskApi) [root@67 flaskDemo]# yum -y install nginx 19 已加載插件:fastestmirror, langpacks 20 Loading ......

    uj5u.com 2020-09-10 00:13:13 more
  • Linux查看服務器暴力破解ssh IP

    在公網的服務器上經常遇到別人爆破你服務器的22埠,用來挖礦或者干其他嘿嘿嘿的事情~ 這種情況下正確的做法是: 修改默認ssh的22埠 使用設定密鑰登錄或者白名單ip登錄 建議服務器密碼為復雜密碼 創建普通用戶登錄服務器(root權限過大) 建立堡壘機,實作統一管理服務器 統計爆破IP [root ......

    uj5u.com 2020-09-10 00:13:17 more
  • CentOS 7系統常見快捷鍵操作方式

    Linux系統中一些常見的快捷方式,可有效提高操作效率,在某些時刻也能避免操作失誤帶來的問題。 ......

    uj5u.com 2020-09-10 00:13:31 more
  • CentOS 7作業系統目錄結構介紹

    作業系統存在著大量的資料檔案資訊,相應檔案資訊會存在于系統相應目錄中,為了更好的管理資料資訊,會將系統進行一些目錄規劃,不同目錄存放不同的資源。 ......

    uj5u.com 2020-09-10 00:13:35 more
最新发布
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:43:21 more
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:42:36 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:26:53 more
  • 設定Windows主機的瀏覽器為wls2的默認瀏覽器

    這里以Chrome為例。 1. 準備作業 wsl是可以使用Windows主機上安裝的exe程式,出于安全考慮,默認情況下改功能是無法使用。要使用的話,終端需要以管理員權限啟動。 我這里以Windows Terminal為例,介紹如何默認使用管理員權限打開終端,具體操作如下圖所示: 2. 操作 wsl ......

    uj5u.com 2023-04-19 09:25:49 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:19:04 more
  • Linux學習筆記

    IP地址和主機名 IP地址 ifconfig可以用來查詢本機的IP地址,如果不能使用,可以通過install net-tools安裝。 Centos系統下ens33表示主網卡;inet后表示IP地址;lo表示本地回環網卡; 127.0.0.1表示代指本機;0.0.0.0可以用于代指本機,同時在放行設 ......

    uj5u.com 2023-04-18 06:52:01 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:50 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:01 more
  • 你是不是暴露了?

    作者:袁首京 原創文章,轉載時請保留此宣告,并給出原文連接。 如果您是計算機相關從業人員,那么應該經歷不止一次網路安全專項檢查了,你肯定是收到過資訊系統技術檢測報告,要求你加強風險監測,確保你提供的系統服務堅實可靠了。 沒檢測到問題還好,檢測到問題的話,有些處理起來還是挺麻煩的,尤其是線上正在運行的 ......

    uj5u.com 2023-04-05 16:52:56 more
  • 細節拉滿,80 張圖帶你一步一步推演 slab 記憶體池的設計與實作

    1. 前文回顧 在之前的幾篇記憶體管理系列文章中,筆者帶大家從宏觀角度完整地梳理了一遍 Linux 記憶體分配的整個鏈路,本文的主題依然是記憶體分配,這一次我們會從微觀的角度來探秘一下 Linux 內核中用于零散小記憶體塊分配的記憶體池 —— slab 分配器。 在本小節中,筆者還是按照以往的風格先帶大家簡單 ......

    uj5u.com 2023-04-05 16:44:11 more