[精讚] [會員登入]
294

vue js 與teleport

vue js 與 teleport 範例 <!DOCTYPE html> <html> <

分享此文連結 //n.sfs.tw/16488

分享連結 vue js 與teleport @igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
最後編修
2025-02-21 13:40:28 By igogo
 

 

vue js 與 teleport 範例

 

<!DOCTYPE html>
<html>
<head>
  <title>Vue.js Teleport Hello World</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
</head>
<body>
  <div id="app">
    <button @click="showModal = true">顯示</button>
    <teleport to="body">
      <div v-if="showModal" class="modal">
        <h2>show modal!</h2>
        <button @click="showModal = false">關閉</button>
      </div>
    </teleport>
    

    
    <div id="message">
    </div>
  </div>

  <script>
    const { createApp } = Vue;

    createApp({
      data() {
        return {
          showModal: false
        }
      }
    }).mount('#app');
  </script>

  <style>
    .modal {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: white;
      padding: 20px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
  </style>
</body>
</html>

 

END

你可能感興趣的文章

題庫批次匯入google表單 請先建一新試算表, 將題目轉成格式如下 並將網址列記下來, 後續的題目就是從此試算表讀出 題目 答案 選項一 選項二 選

javascript 陣列 javascript 陣列可以放各种型別的元素 let data = [1,2,"john",tru

axios vuejs application/x-www-form-urlencoded 送資料 VUE.JS 以 application/x-www-form-urlencoded 送資料

[vue.js] input event Form-Input-Components-using-Custom-Events

vue.js components 多個組件的呈現 vue.js 組件 component

vue js 與teleport vue js 與 teleport 範例 <!DOCTYPE html> <html> <

隨機好文

臺中市雲端校務系統與Windows AD帳號整合(3) LDAP的基本概念

spring boot jpa 使用多個欄位排序 我有一entity 叫 team 資料欄下如下 @Id @GeneratedValue(strategy = Gener

管理Google共用雲端硬碟 管理Google共用雲端硬碟

spring boot 3 建立 Basic Authentication 參考以下網站, 建立一個http basic authentication 為例 https://www.geeksfo

關閉chrome不小心按到的訂閱通知 https://support.google.com/chrome/answer/3220216?hl=zh-Hant&