成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

vue如何動(dòng)態(tài)配置模板'componentis'

小編給大家分享一下vue如何動(dòng)態(tài)配置模板 'component is',相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

專注于為中小企業(yè)提供網(wǎng)站設(shè)計(jì)制作、網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)東港免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了近千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

實(shí)現(xiàn)代碼如下

<template>
 <div v-if='object.child'>
   <div v-for="(item,ix) in object.child" :key="ix">
    <component :is="item.xtype" v-if='item'
     :objectVlue="objectVlue"
     :object="item">
    </component>
   </div>
 </div>
</template>
<script>
export default {
 data() {
  return {
  };
 },
 props: {
  objectVlue:Object,
  object:Object,
 },
 created() {
  var itemType = require(`../units/unit-type.js`).default||{};//1.0
  this.object.child.forEach(item=>{
   if(item.fileName){
    item.objDefault = require(`@/scene/${this.$route.query.typeName}/config/${item.fileName}.js`);//2.0
   }   
  })

  this.object.child.forEach(item=>{//動(dòng)態(tài)顯示當(dāng)前組件
   if(itemType[item.xtype])
   Vue.component(
    itemType[item.xtype].componentName,
    () => import(`@/components/info-collection/moudel/${itemType[item.xtype].fileName}`)
   )
  })
 }
};
</script>
//1.0=============unit-type.js所有模板配置文件 =======================
export default {
 tablePartMerge: {//表格合并模板xtype
   componentName: "tablePartMerge",//組件名稱
   fileName: "table-partInfo-merge"//文件所在路徑
 },
 tablePartInfo: {
   componentName: "tablePartInfo",
   fileName: "table-partInfo"
 },
 ueditorUnit: {
   componentName: "ueditorUnit",
   fileName: "unit-ueditor"
 },
 filesUnit: {
   componentName: "filesUnit",
   fileName: "unit-files"
 },
 approves: {  // 正文信息(審批記錄)
   componentName: "approves",
   fileName: "approves-unit"
 },
 requiredDate:{ // 要求完成日期
  componentName: "requiredDate",
  fileName: "required-date"
 },
}
//2.0====== table-partInfo-merge.js =========
module.exports = {
 "columns":[{
  "id": "partNumber",
  "disabled": false,
  "name":"物料編碼",
  "placeholder": "",
  "required": true,
  "selectDetail": [],
  "show": false,
  "span": 24,
  "width":"150",
  "xtype": "select"//組件內(nèi)用的表格
 }]
}

//=============父級傳過來的 object =======================
module.exports = [
  {
    title: '正文信息',
    name: '1',
    id:"",
    child:[
      {
        id:'partInfoData',//id
        show:'true',//是否顯示
        fileName:'tablePartInfo',//文件路徑名
        xtype:'tablePartMerge'//表格模塊
      },
      {
        id:'mainAttachements',//文本編輯器
        show:'true',
        fileName:'',
        xtype:'filesUnit'
      },
      {
        id:'vivo_RequestCompletionTime',//時(shí)間選擇模塊
        show:'true',
        fileName:'',
        xtype:'requiredDate'
      },
      {
        id:'approves',
        show:'true',
        fileName:'approval',
        xtype:'approves'
      }
    ]
  }
];

以上是“vue如何動(dòng)態(tài)配置模板 'component is'”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)站標(biāo)題:vue如何動(dòng)態(tài)配置模板'componentis'
鏈接分享:http://jinyejixie.com/article42/jdoshc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、建站公司、用戶體驗(yàn)、網(wǎng)站收錄移動(dòng)網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)
衡水市| 云南省| 封开县| 五华县| 湖南省| 韶关市| 通山县| 镇江市| 宜宾市| 邹平县| 高安市| 涞源县| 天柱县| 灵璧县| 博客| 西林县| 鲁山县| 九龙城区| 和田市| 秭归县| 台中市| 赤峰市| 乐陵市| 华坪县| 互助| 蒙阴县| 黔西| 平乐县| 东光县| 海宁市| 肥西县| 东阳市| 金山区| 通州市| 阿拉善左旗| 平利县| 南澳县| 芜湖市| 务川| 万源市| 普兰店市|