vue中form表單禁用專(zhuān)用組件介紹
更新時(shí)間:2024年01月16日 08:39:24 作者:是文靜的
這篇文章主要介紹了vue中form表單禁用專(zhuān)用組件,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
form表單禁用專(zhuān)用組件
JFormContainer.vue
<template>
<div :class="disabled?'jeecg-form-container-disabled':''">
<fieldset :disabled="disabled">
<slot name="detail"></slot>
</fieldset>
<slot name="edit"></slot>
<fieldset disabled>
<slot></slot>
</fieldset>
</div>
</template>
<script>
/**
* 使用方法
* 在form下直接寫(xiě)這個(gè)組件就行了,
*<a-form layout="inline" :form="form" >
* <j-form-container :disabled="true">
* <!-- 表單內(nèi)容省略..... -->
* </j-form-container>
*</a-form>
*/
export default {
name: 'JFormContainer',
props: {
disabled: {
type: Boolean,
default: false,
required: false
}
},
mounted () {
console.log('我是表單禁用專(zhuān)用組件,但是我并不支持表單中iframe的內(nèi)容禁用')
}
}
</script>
<style>
.jeecg-form-container-disabled{
cursor: not-allowed;
}
.jeecg-form-container-disabled fieldset[disabled] {
-ms-pointer-events: none;
pointer-events: none;
}
.jeecg-form-container-disabled .ant-select{
-ms-pointer-events: none;
pointer-events: none;
}
.jeecg-form-container-disabled .ant-upload-select{display:none}
.jeecg-form-container-disabled .ant-upload-list{cursor:grabbing}
.jeecg-form-container-disabled fieldset[disabled] .ant-upload-list{
-ms-pointer-events: auto !important;
pointer-events: auto !important;
}
.jeecg-form-container-disabled .ant-upload-list-item-actions .anticon-delete,
.jeecg-form-container-disabled .ant-upload-list-item .anticon-close{
display: none;
}
</style><template>
<a-form layout="inline" :form="form" >
<j-form-container :disabled="true">
<!-- 表單內(nèi)容省略..... -->
<a-row class="form-row" :gutter="16">
<a-col :lg="10" :md="10" :sm="20">
<a-form-item label="文件">
<a-button> <a-icon type="upload" /> 上傳 </a-button>
</a-form-item>
</a-col>
</a-row>
<a-row class="form-row" :gutter="16">
<a-col :lg="10" :md="10" :sm="20">
<a-form-item label="文件">
<a-button> <a-icon type="upload" /> 上傳 </a-button>
</a-form-item>
</a-col>
</a-row>
</j-form-container>
</a-form>
</template><script>
import JFormContainer from '@/components/jeecg/JFormContainer'
export default {
components: {
JFormContainer
},
data () {
return {
form: this.$form.createForm(this)
}
},
methods: {}
}
</script>
<style scoped>
</style>總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Vue3點(diǎn)擊側(cè)邊導(dǎo)航欄完成切換頁(yè)面內(nèi)組件全過(guò)程(WEB)
寫(xiě)頁(yè)面的時(shí)候都會(huì)用到一些導(dǎo)航欄、點(diǎn)擊不同的部分切換不同的頁(yè)面,下面這篇文章主要給大家介紹了關(guān)于Vue3點(diǎn)擊側(cè)邊導(dǎo)航欄完成切換頁(yè)面內(nèi)組件的相關(guān)資料,需要的朋友可以參考下2023-06-06
vue項(xiàng)目部署上線(xiàn)遇到的問(wèn)題及解決方法
這篇文章主要介紹了vue項(xiàng)目部署上線(xiàn)遇到的問(wèn)題及解決方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下2018-06-06
Vue Cli3 創(chuàng)建項(xiàng)目的方法步驟
Vue CLI是一個(gè)用于快速Vue.js開(kāi)發(fā)的完整系統(tǒng)。這篇文章主要介紹了Vue Cli3 創(chuàng)建項(xiàng)目的方法步驟,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2018-10-10
Vue3新?tīng)顟B(tài)管理工具實(shí)例詳解
Vue3公布曾經(jīng)有一段時(shí)間了,它采納了新的響應(yīng)式零碎,而且構(gòu)建了一套全新的 Composition API,下面這篇文章主要給大家介紹了關(guān)于Vue3新?tīng)顟B(tài)管理工具的相關(guān)資料,需要的朋友可以參考下2022-03-03
Vue3 去除 vue warn 及生產(chǎn)環(huán)境去除console.log的方法
這篇文章主要介紹了Vue3 去除 vue warn 及生產(chǎn)環(huán)境去除console.log的方法,本文結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-06-06
vue3+ts+elementui-plus二次封裝彈框?qū)崙?zhàn)教程
這篇文章主要介紹了vue3+ts+elementui-plus二次封裝彈框?qū)崙?zhàn)教程,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-07-07

