這是乙個提示框和對話方塊,例:
>取消
div>
<
div
class
='kz-btn'
@click
='took'
>確定
div>
div>
div>
div>
template
>
<
script
>
export
default
, took:
function
() }
}script
>
<
style
scoped
>
.kz-cont
.kz-cont:after
.kz-text
.footer
.kz-btn
.kz-btn +.kz-btn
style
>
<script
>
import eject from
'./eject
'export
default
, data()
},methods:,
confirms(),
okfall(),
cancelfall(),
okfall2()
}}script
>
<template
>
<
div
class
='zk-box'
>
<
div
class
='zk-flex
zk-pd'
>
<
div
class
='zk-btn'
@click
='alerts'
>提示框
div>
<
eject
type
='alert'
@took
='okfall'
:showstate
='showa'
>
<
span
slot
='tlt'
>提示
span
>
<
div
slot
='text'
>這是乙個提示彈窗
div>
eject
>
div>
<
div
class
='zk-flex
zk-pd'
>
<
div
class
='zk-btn
zk-blue' @click
='confirms'
>對話方塊
div>
<
eject
type
='confirm'
@took
='okfall2'
@tocancel
='cancelfall'
:showstate
='showc'
>
<
span
slot
='tlt'
>確認
span
>
<
div
slot
='text'
>}
div>
eject
>
div>
div>
template
>
<template
>
<
div
class
='zk-box'
>
<
div
class
='zk-flex
zk-pd'
>
<
div
class
='zk-btn'
@click
='alerts'
>提示框
div>
<
eject
type
='alert'
@took
='okfall'
:showstate
='showa'
>
<
span
slot
='tlt'
>提示
span
>
<
div
slot
='text'
>這是乙個提示彈窗
div>
eject
>
div>
<
div
class
='zk-flex
zk-pd'
>
<
div
class
='zk-btn
zk-blue' @click
='confirms'
>對話方塊
div>
<
eject
type
='confirm'
@took
='okfall2'
@tocancel
='cancelfall'
:showstate
='showc'
>
<
span
slot
='tlt'
>確認
span
>
<
div
slot
='text'
>}
div>
eject
>
div>
div>
template
>
<
script
>
import eject from
'./eject
'export
default
, data()
},methods:,
confirms(),
okfall(),
cancelfall(),
okfall2()
}}script
>
<
style
>
.zk-box
.zk-flex
.zk-pd
.zk-btn
.zk-blue
style
>
vue封裝元件 父子傳值 (彈框例項)
components home.vue 顯示 components count index.vue 這是一段自己封裝的dialog 取 消 確 定 總結 結合上面的 看 1.父元件呼叫子元件的方法 methods getchildmethods this.refs.child.childmethod...
vue如何封裝乙個元件
1.新增子元件 在工程src components目錄下新建乙個資料夾用於存放元件。我封裝了乙個樹元件,資料夾名稱為va tree,裡面有乙個va tree.vue檔案,寫了樹元件的具體內容,包括元件樣式 元件處理邏輯 元件模板等等 子元件中定義的props是父元件需要傳給子元件的資料,在子元件中p...
vue實現點選乙個按鈕出現彈框,點選彈框外關閉彈框
vue實現點選乙個按鈕出現彈框,點選彈框外關閉彈框 效果圖展示 view層 點選出現彈框 點選出現彈框 資料層 樣式層 關鍵點 1.mask層的層級 z index 要比彈出的pop的層級低。2.wow,寫完啦,就是這麼簡單.完整 點選出現彈框 點選出現彈框 擴充套件 按鈕在父元件,彈框是乙個子元件...