Tin Chen
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: Bootstrap5網頁切版整合術 --- # 12. 後台管理 - 功能性為導向的介面規劃 ## 後台管理章節說明 後台管理的功能較多,主要會由內部人員或特定人員來操作,所以不一定要符合rwd ![](https://i.imgur.com/lrlH0yv.png) ## 結構規劃 1. 桌機版左側選單為開啟,行動版為收合,右側上`<a>`標籤按鈕,可展開收合左側的sidebar選單 2. 左側選單縮小視窗時或空間不足時,選單內容會加上垂直卷軸滾動 3. 右側.main依瀏覽器剩餘寬度 ### 建立結構 1. 新增資料夾components>_sidebar.scss,在all.scss匯入 2. 左側定義變數`$sidebar-width: 280px;` 3. 右側.main的寬度用calc來計算, 這裡變數會被視為字串,所以要再加上`#{}`才能運算 4. 右側上方按鈕: `<a>`設定.d-inline-block就不會占滿整個空間 ; 在bs icon搜尋expand,加入icon ```html <div class="d-flex"> <aside class="sidebar vh-100 border-end"> </aside> <main class="main"> <div class="bg-white border-bottom w-100"> <a href="#" class="py-3 px-4 d-inline-block border-end"> <i class="bi bi-arrows-angle-expand"></i> </a> </div> </main> </div> ``` ```css $sidebar-width: 280px; .sidebar{ width: $sidebar-width; } .main{ width: calc(100vw - #{$sidebar-width}); } ``` ## 可收合側欄選單sidebar <small>:star: :star: :star:</small> ![](https://i.imgur.com/Julln2i.png) **_sidebar.scss:** 1. 先前套用up的中斷點都是使用class方式套用,這裡用scss方式,文件>排版>斷點,找到最小寬度`media-breakpoint-up(lg)`,lg以上尺寸才會套用。 ![](https://i.imgur.com/NVv3CZ7.png) 2. 複製語法media-breakpoint-up(lg){},將剛才建立的結構,內容移到裡面 3. 行動版(預設): (1)sidebar寬為 sidebar-width; margin-left: -$sidebar-width; 用負值將選單位移到畫面外,位移速度建議快一點; (2)main為滿寬100% 4. 桌機版: sidebar寬為$sidebar-width,因受到行動版margin-left負值影響,需要再將sidebar移回來,所以要設定margin-left:0; ```_sidebar.scss $sidebar-width: 280px; //行動版(預設) .sidebar{ width: $sidebar-width; margin-left: -$sidebar-width; transition: margin-left .25s; } .main{ width: 100%; } //桌機版(up) @include media-breakpoint-up(lg) { .sidebar{ margin-left: 0; width: $sidebar-width; } .main { width: calc(100vw - #{$sidebar-width}); } } ``` <small>這裡實作時一直出現編譯錯誤"找不到這個mixin",原來是 @import順序 出錯了,自訂的要放在後面 ```css @import "./node_modules/bootstrap/scss/functions"; @import "./node_modules/bootstrap/scss/bootstrap"; @import "./helpers/variables"; @import "./components/sidebar"; ``` </small> ### 選單收合: ![](https://i.imgur.com/fBr8Ztx.jpg) <small>-在這裡先把樣式寫好,下一節會用js,點擊按鈕後在body加入或移除.sidebar-toggled -測試的時候可以先用開發者工具,手動在body加上.sidebar-toggled </small> 1. 新增class名稱為.sidebar-toggled 作為展開sidebar用 2. 行動版 將選單移回來(按下按鈕後) ```css .sidebar-toggled{ .sidebar{ margin-left:0; } } ``` 3. 桌機版 選單往外移(按下按鈕後) ```css .sidebar-toggled { .sidebar { margin-left: -$sidebar-width; } .main{ width: 100%; margin-left: 0; } } ``` ### JS效果 點擊按鈕展開收合選單 1. 在`<a>`加上id="toggle-btn",js選取用 2. 新增javascripts資料夾,新增all.js檔,再到html body結尾之前匯入 3. 點擊`<a>`標籤切換樣式.sidebar-toggled ![](https://i.imgur.com/artarD0.png) <small>(這裡不懂js沒關係先略過)</small> ## 側欄選單內容 ![](https://i.imgur.com/Tav5Ufc.png) sidebar: 縮小視窗時或空間不足時,選單會加上垂直卷軸滾動 1. 先將sidebar選單加上.d-flex.flex-column方向垂直 2. 內層分為後台名稱、選單、登出按鈕三個結構, 登出按鈕加上.mt-auto把按鈕推到最下面, 中間選單內容加上.overflow-auto 3. 在_sidebar.scss新增.sidebar-link、.sidebar-link.active的設定 首頁按鈕加上.sidebar-link.active 登出按鈕加上.sidebar-link ![](https://i.imgur.com/boxEUEE.png) 4. 選單 ![](https://i.imgur.com/ZcOVl2v.png) 5. 選單下拉內容加上.collapse、加上id="menu-order" 6. 到文件>摺疊>在要折疊的外層`<a>`標籤加上.data-bs-toggle="collapse" ,href="#menu-order"連結到要收合的內容 ![](https://i.imgur.com/0wEQdnX.png) ![](https://i.imgur.com/57gPRO3.png) ## 版型整理、固定左側選單、固定上方導覽列 1. 版型整理: 將index.html改名為layout.html,這基本的版型其他頁面也會用到,所以拉出layout來管理共用的版型 (後端會使用template language、前端用vue或react) 2. 固定左側選單: .sidebar寫position: fixed; top:0; 固定在左側 .main要再位移回來 ![](https://i.imgur.com/lkB3GM0.png) 手機版:展開sidebar要加入margin-left:$sidebar-width; 按鈕就不會被擋住 ![](https://i.imgur.com/O21k51N.png) 3. 固定上方導覽列: 在導覽列加上.sticky-top,滾動內容時,選單會在內容的上方 ![](https://i.imgur.com/pwPEKWA.png) ## 卡片區塊結構+動態圖表範例程式碼 ![](https://i.imgur.com/LZDK2p3.png) 1. 將layout.html另存為home.html 2. 到_variables調整圓角 * bordre-radius 會調整到所有的圓角,這裡不需要調整全部 * 可新增變數或調整bordre-radius-lg:0.75rem;//.3rem!default * 卡片圓角也要修改 $card-border-radius: $border-radius-lg; ![](https://i.imgur.com/XPVQtRI.png) <small>官方變數檔裡面有新增xl、2xl、pill</small> 3. 建立三欄卡片.row>col*3>.card>.card-body ![](https://i.imgur.com/qIgFEYk.png) 4. 建立二欄卡片 左col-4 右col ![](https://i.imgur.com/MckKIJ6.png) * 左邊已設定col-4所以右邊可以寫col就好 * `<canvas>`跟`<img>`很像,要再加入.img-fluid,才不會拉動後掉到下一排 * 把canvas的程式碼貼在main裡面 * 將兩個卡片設定等高h-100 ![](https://i.imgur.com/t0RRIjD.png) ## 表格運用 ![](https://i.imgur.com/nXQ2VSP.png) * 這裡使用.card搭配.card-header、.card-body'、card-footer 1. card-header: input搭配.form-control,再用.shadow-none.border-0 把hover:foucs的陰影框線拿掉 ![](https://i.imgur.com/Hjm0voh.png) 2. card-body: * 將表格加入響應式.table-responsive.table-hover * .thead內距加大,.py-3加在訂單編號就可以,再到tr加上.align-middle就可以全部垂直對齊 ![](https://i.imgur.com/3NG1Kfd.png) ![](https://i.imgur.com/oeycikj.png) * 在tbody加上.text-nowrap避免文字換行,行動版表格可左右滾動 ![](https://i.imgur.com/737sHsI.png) ![](https://i.imgur.com/fSiAvCl.png) 3. card-footer: * 到元件>分頁,複製程式碼貼進來 ![](https://i.imgur.com/mv3ay74.png) ## 訂單管理介面 ## 傳遞內容至 Modal 內 ## 單一產品頁面製作 ## Sticky 與 scroll spy 的混合運用 ## 作業製作

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully