第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

JS:傳遞一個(gè)包含函數(shù)/方法屬性的對(duì)象,然后在另一個(gè)文件中傳遞并調(diào)用傳入的對(duì)象函數(shù)/方法屬性?

JS:傳遞一個(gè)包含函數(shù)/方法屬性的對(duì)象,然后在另一個(gè)文件中傳遞并調(diào)用傳入的對(duì)象函數(shù)/方法屬性?

吃雞游戲 2023-09-14 18:20:54
我正在努力為登錄功能添加額外的檢查。如果傳遞給函數(shù)的對(duì)象包含屬性名稱(chēng)additionalSteps,它將調(diào)用additionalSteps 屬性。但是,每當(dāng)我到達(dá)調(diào)用步驟時(shí),都會(huì)收到一條錯(cuò)誤消息,指出該屬性不是函數(shù)或未定義。options.additionalSteps(取決于我如何通過(guò)調(diào)用對(duì)象 property( ) 或?qū)⒕植孔兞糠峙浣o對(duì)象 property( )來(lái)調(diào)整代碼let additionalSteps。)我想知道是否可以傳遞一個(gè)具有定義函數(shù)/方法的屬性的對(duì)象,然后將該對(duì)象傳遞到導(dǎo)入類(lèi)(或使用)的函數(shù)中,該函數(shù)將檢查屬性名稱(chēng)是否存在,然后調(diào)用該對(duì)象的require函數(shù)如果條件為真。我可以讓其他文件定義并處理該函數(shù),但我希望用戶(hù)按照他們的意愿定義屬性函數(shù)。根據(jù)我對(duì)該主題的研究,我對(duì)屬性的感覺(jué)是不可能通過(guò)對(duì)象內(nèi)的另一個(gè)文件傳遞函數(shù)/方法。(有關(guān)具有函數(shù)的對(duì)象屬性的所有信息和示例似乎暗示這不受支持。)測(cè)試代碼:async function fewMoreSteps({page, options} = {}) {  console.log('This is the addtional step...')  await page.waitForSelector('#header_notification_link', {visible: true})  await page.click('#header_notification_link')}describe('Test Login', () => {  // eslint-disable-next-line jest/no-focused-tests  it.only('Login with custom function', () => {    const username = Cypress.env('steamUserName')    const password = Cypress.env('steamUserNamePW')    const loginUrl = Cypress.env('loginUrl')    const loginSelector = Cypress.env('loginSelector')    const cookieName = Cypress.env('cookieName')    const socialLoginOptions = {      username,      password,      loginUrl,      // Add username/pw fields and buttons and addtional steps      usernameField: '#input_username',      passwordField: '#input_password',      passwordSubmitBtn: '#login_btn_signin',      // make this a global passed function      additionalSteps: async function({page, options} = {}) {        /*console.log('This is the addtional step...')        await page.waitForSelector('#header_notification_link', {visible: true})        await page.click('#header_notification_link') */         await fewMoreSteps({page, options})      },      isPopup: true,      popupDelay: 6000,      logs: true,      headless: false,      loginSelector: loginSelector,      postLoginClick: '#account_pulldown',      postLoginSelector: '#account_dropdown div.popup_menu a.popup_menu_item:first-of-type'    }
查看完整描述

1 回答

?
慕姐4208626

TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超7個(gè)贊

您可以簡(jiǎn)單地添加點(diǎn)擊事件


dropdown-item

見(jiàn)下文


$('.dropdown-menu .dropdown-item').click(function(){

     var value = $(this).text();

     console.log(value)

     // Update the value and show it to the user

     $(this).parent().parent().find(".dropdown-toggle").html(value);


});

<!DOCTYPE html>

<html>


<head>

  <title>Bootstrap 4 Search Box With Dropdown List</title>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">

  <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>

  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>

  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>


  <body>

    <div class="search-box col-md-5">

      <form action="">

        <div class="input-group mb-3">

          <div class="input-group-prepend">

            <button class="btn btn-light dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">All</button>

            <div class="dropdown-menu">

              <a class="dropdown-item" href="#">Category One</a>

              <a class="dropdown-item" href="#">Category Two</a>

              <a class="dropdown-item" href="#">Category Three</a>

              <div role="separator" class="dropdown-divider"></div>

              <a class="dropdown-item" href="#">Separated Category</a>

            </div>

          </div>

          <input type="text" class="form-control" aria-label="Search input with dropdown button">

          <div class="input-group-append">

            <button class="btn btn-success" type="button">Search</button>

          </div>

        </div>

      </form>

    </div>

  </body>


</html>


查看完整回答
反對(duì) 回復(fù) 2023-09-14
  • 1 回答
  • 0 關(guān)注
  • 101 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)