使用基礎 vue 構造器,建立乙個「子類」。引數是乙個包含元件選項的物件
.vue單檔案經過webpack打包之後是乙個元件示例物件,因此可以傳到vue.extend中生成乙個包含此元件的類
new vuecomponent() 建立例項,呼叫$mount()可以手動編譯
手動編譯後的示例物件中存在乙個$el物件(dom元素),可以作為模板被插入到頁面中。
class=""
>
="popup-mask" v-if=
"hasmark"
>
<
/div>
"bottom"
>
="popup-note bottom"
>
="pop-content"
>
="pop-tit"
>
}<
/div>
="pop-note hastitle"
>
="msg" v-html=
"msg"
>
<
/span>
<
/p>
="type == 'alert'" @click.stop=
"alertclick"
>
="btn btn-block yes-btn"
>
}<
/span>
<
/div>
="type == 'confirm'"
>
"noclick"
class
="btn"
>
}<
/span>
"yesclick"
class
="btn yes-btn"
>
}<
/span>
<
/div>
<
/div>
<
/div>
<
/transition>
<
/div>
<
/template>
export
default
, msg:
, type:
, alertbtntext:
, yesbtntext:
, nobtntext:
, hasmark:},
data()
},methods:;}
);},
noclick()
,yesclick()
,alertclick()
}}<
/script>
'less'
>
@import
"../../../static/less/components/tip/index.less"
;<
/style>
import vue from
'vue'
import message from
'./message.vue'
const vuecomponent = vue.
extend
(message)
;const vm =
newvuecomponent()
.$mount()
;let init =
false
;let defaultoptions =
;const
confirm
=function
(options));
if(!init)
return vm.
confirm()
;};export
default confirm;
import confirm from
'./views/components/message/confirm'
vue.prototype.$confirm = confirm;
this
.$confirm()
.then((
)=>).
catch((
)=>
);
swift 自定義彈窗
在專案中,有的時候需要用到一些特殊的彈窗,並在彈窗上新增一些自定義的功能,這個時候我們就需要自定義彈窗了 帶xib的彈窗檔案 呼叫彈窗的方法 class func show view uiview?alertview else let nib uinib nibname alertview bund...
ionic ionicPopup 自定義彈窗
ionic 彈窗寫法 上述鏈結所講的彈窗內容模板是官網固定寫好的,有時就不滿足自己專案所需,官網介紹了乙個屬性,可以自定義彈窗內容 templateurl 所引用 彈窗內容的 html檔案位址 彈窗 var confirmpopup ionicpopup.confirm confirmpopup.t...
模擬Confirm的Web自定義控制項
using system using system.web.ui using system.web.ui.webcontrols using system.componentmodel using system.collections using system.collections.special...