最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Element Cascader 級(jí)聯(lián)選擇器的使用示例

 更新時(shí)間:2020年07月27日 11:34:27   作者:ForeverJPB.  
這篇文章主要介紹了Element Cascader 級(jí)聯(lián)選擇器的使用示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

組件—級(jí)聯(lián)選擇器

基礎(chǔ)用法

<div class="block">
 <span class="demonstration">默認(rèn) click 觸發(fā)子菜單</span>
 <el-cascader
  v-model="value"
  :options="options"
  @change="handleChange"></el-cascader>
</div>
<div class="block">
 <span class="demonstration">hover 觸發(fā)子菜單</span>
 <el-cascader
  v-model="value"
  :options="options"
  :props="{ expandTrigger: 'hover' }"
  @change="handleChange"></el-cascader>
</div>

<script>
 export default {
  data() {
   return {
    value: [],
    options: [{
     value: 'zhinan',
     label: '指南',
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計(jì)原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導(dǎo)航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導(dǎo)航'
      }]
     }]
    }, {
     value: 'zujian',
     label: '組件',
     children: [{
      value: 'basic',
      label: 'Basic',
      children: [{
       value: 'layout',
       label: 'Layout 布局'
      }, {
       value: 'color',
       label: 'Color 色彩'
      }, {
       value: 'typography',
       label: 'Typography 字體'
      }, {
       value: 'icon',
       label: 'Icon 圖標(biāo)'
      }, {
       value: 'button',
       label: 'Button 按鈕'
      }]
     }, {
      value: 'form',
      label: 'Form',
      children: [{
       value: 'radio',
       label: 'Radio 單選框'
      }, {
       value: 'checkbox',
       label: 'Checkbox 多選框'
      }, {
       value: 'input',
       label: 'Input 輸入框'
      }, {
       value: 'input-number',
       label: 'InputNumber 計(jì)數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級(jí)聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開(kāi)關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時(shí)間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時(shí)間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評(píng)分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標(biāo)簽'
      }, {
       value: 'progress',
       label: 'Progress 進(jìn)度條'
      }, {
       value: 'tree',
       label: 'Tree 樹(shù)形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁(yè)'
      }, {
       value: 'badge',
       label: 'Badge 標(biāo)記'
      }]
     }, {
      value: 'notice',
      label: 'Notice',
      children: [{
       value: 'alert',
       label: 'Alert 警告'
      }, {
       value: 'loading',
       label: 'Loading 加載'
      }, {
       value: 'message',
       label: 'Message 消息提示'
      }, {
       value: 'message-box',
       label: 'MessageBox 彈框'
      }, {
       value: 'notification',
       label: 'Notification 通知'
      }]
     }, {
      value: 'navigation',
      label: 'Navigation',
      children: [{
       value: 'menu',
       label: 'NavMenu 導(dǎo)航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標(biāo)簽頁(yè)'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對(duì)話框'
      }, {
       value: 'tooltip',
       label: 'Tooltip 文字提示'
      }, {
       value: 'popover',
       label: 'Popover 彈出框'
      }, {
       value: 'card',
       label: 'Card 卡片'
      }, {
       value: 'carousel',
       label: 'Carousel 走馬燈'
      }, {
       value: 'collapse',
       label: 'Collapse 折疊面板'
      }]
     }]
    }, {
     value: 'ziyuan',
     label: '資源',
     children: [{
      value: 'axure',
      label: 'Axure Components'
     }, {
      value: 'sketch',
      label: 'Sketch Templates'
     }, {
      value: 'jiaohu',
      label: '組件交互文檔'
     }]
    }]
   };
  },
  methods: {
   handleChange(value) {
    console.log(value);
   }
  }
 };
</script>

禁用選項(xiàng)

<el-cascader :options="options"></el-cascader>

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     disabled: true,
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計(jì)原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導(dǎo)航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導(dǎo)航'
      }]
     }]
    }, {
     value: 'zujian',
     label: '組件',
     children: [{
      value: 'basic',
      label: 'Basic',
      children: [{
       value: 'layout',
       label: 'Layout 布局'
      }, {
       value: 'color',
       label: 'Color 色彩'
      }, {
       value: 'typography',
       label: 'Typography 字體'
      }, {
       value: 'icon',
       label: 'Icon 圖標(biāo)'
      }, {
       value: 'button',
       label: 'Button 按鈕'
      }]
     }, {
      value: 'form',
      label: 'Form',
      children: [{
       value: 'radio',
       label: 'Radio 單選框'
      }, {
       value: 'checkbox',
       label: 'Checkbox 多選框'
      }, {
       value: 'input',
       label: 'Input 輸入框'
      }, {
       value: 'input-number',
       label: 'InputNumber 計(jì)數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級(jí)聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開(kāi)關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時(shí)間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時(shí)間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評(píng)分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標(biāo)簽'
      }, {
       value: 'progress',
       label: 'Progress 進(jìn)度條'
      }, {
       value: 'tree',
       label: 'Tree 樹(shù)形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁(yè)'
      }, {
       value: 'badge',
       label: 'Badge 標(biāo)記'
      }]
     }, {
      value: 'notice',
      label: 'Notice',
      children: [{
       value: 'alert',
       label: 'Alert 警告'
      }, {
       value: 'loading',
       label: 'Loading 加載'
      }, {
       value: 'message',
       label: 'Message 消息提示'
      }, {
       value: 'message-box',
       label: 'MessageBox 彈框'
      }, {
       value: 'notification',
       label: 'Notification 通知'
      }]
     }, {
      value: 'navigation',
      label: 'Navigation',
      children: [{
       value: 'menu',
       label: 'NavMenu 導(dǎo)航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標(biāo)簽頁(yè)'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對(duì)話框'
      }, {
       value: 'tooltip',
       label: 'Tooltip 文字提示'
      }, {
       value: 'popover',
       label: 'Popover 彈出框'
      }, {
       value: 'card',
       label: 'Card 卡片'
      }, {
       value: 'carousel',
       label: 'Carousel 走馬燈'
      }, {
       value: 'collapse',
       label: 'Collapse 折疊面板'
      }]
     }]
    }, {
     value: 'ziyuan',
     label: '資源',
     children: [{
      value: 'axure',
      label: 'Axure Components'
     }, {
      value: 'sketch',
      label: 'Sketch Templates'
     }, {
      value: 'jiaohu',
      label: '組件交互文檔'
     }]
    }]
   };
  }
 };
</script>

可清空

<el-cascader :options="options" clearable></el-cascader>

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計(jì)原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導(dǎo)航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導(dǎo)航'
      }]
     }]
    }, {
     value: 'zujian',
     label: '組件',
     children: [{
      value: 'basic',
      label: 'Basic',
      children: [{
       value: 'layout',
       label: 'Layout 布局'
      }, {
       value: 'color',
       label: 'Color 色彩'
      }, {
       value: 'typography',
       label: 'Typography 字體'
      }, {
       value: 'icon',
       label: 'Icon 圖標(biāo)'
      }, {
       value: 'button',
       label: 'Button 按鈕'
      }]
     }, {
      value: 'form',
      label: 'Form',
      children: [{
       value: 'radio',
       label: 'Radio 單選框'
      }, {
       value: 'checkbox',
       label: 'Checkbox 多選框'
      }, {
       value: 'input',
       label: 'Input 輸入框'
      }, {
       value: 'input-number',
       label: 'InputNumber 計(jì)數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級(jí)聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開(kāi)關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時(shí)間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時(shí)間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評(píng)分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標(biāo)簽'
      }, {
       value: 'progress',
       label: 'Progress 進(jìn)度條'
      }, {
       value: 'tree',
       label: 'Tree 樹(shù)形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁(yè)'
      }, {
       value: 'badge',
       label: 'Badge 標(biāo)記'
      }]
     }, {
      value: 'notice',
      label: 'Notice',
      children: [{
       value: 'alert',
       label: 'Alert 警告'
      }, {
       value: 'loading',
       label: 'Loading 加載'
      }, {
       value: 'message',
       label: 'Message 消息提示'
      }, {
       value: 'message-box',
       label: 'MessageBox 彈框'
      }, {
       value: 'notification',
       label: 'Notification 通知'
      }]
     }, {
      value: 'navigation',
      label: 'Navigation',
      children: [{
       value: 'menu',
       label: 'NavMenu 導(dǎo)航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標(biāo)簽頁(yè)'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對(duì)話框'
      }, {
       value: 'tooltip',
       label: 'Tooltip 文字提示'
      }, {
       value: 'popover',
       label: 'Popover 彈出框'
      }, {
       value: 'card',
       label: 'Card 卡片'
      }, {
       value: 'carousel',
       label: 'Carousel 走馬燈'
      }, {
       value: 'collapse',
       label: 'Collapse 折疊面板'
      }]
     }]
    }, {
     value: 'ziyuan',
     label: '資源',
     children: [{
      value: 'axure',
      label: 'Axure Components'
     }, {
      value: 'sketch',
      label: 'Sketch Templates'
     }, {
      value: 'jiaohu',
      label: '組件交互文檔'
     }]
    }]
   }
  }
 }
</script>

僅顯示最后一級(jí)

<el-cascader :options="options" :show-all-levels="false"></el-cascader>

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計(jì)原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導(dǎo)航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導(dǎo)航'
      }]
     }]
    }, {
     value: 'zujian',
     label: '組件',
     children: [{
      value: 'basic',
      label: 'Basic',
      children: [{
       value: 'layout',
       label: 'Layout 布局'
      }, {
       value: 'color',
       label: 'Color 色彩'
      }, {
       value: 'typography',
       label: 'Typography 字體'
      }, {
       value: 'icon',
       label: 'Icon 圖標(biāo)'
      }, {
       value: 'button',
       label: 'Button 按鈕'
      }]
     }, {
      value: 'form',
      label: 'Form',
      children: [{
       value: 'radio',
       label: 'Radio 單選框'
      }, {
       value: 'checkbox',
       label: 'Checkbox 多選框'
      }, {
       value: 'input',
       label: 'Input 輸入框'
      }, {
       value: 'input-number',
       label: 'InputNumber 計(jì)數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級(jí)聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開(kāi)關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時(shí)間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時(shí)間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評(píng)分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標(biāo)簽'
      }, {
       value: 'progress',
       label: 'Progress 進(jìn)度條'
      }, {
       value: 'tree',
       label: 'Tree 樹(shù)形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁(yè)'
      }, {
       value: 'badge',
       label: 'Badge 標(biāo)記'
      }]
     }, {
      value: 'notice',
      label: 'Notice',
      children: [{
       value: 'alert',
       label: 'Alert 警告'
      }, {
       value: 'loading',
       label: 'Loading 加載'
      }, {
       value: 'message',
       label: 'Message 消息提示'
      }, {
       value: 'message-box',
       label: 'MessageBox 彈框'
      }, {
       value: 'notification',
       label: 'Notification 通知'
      }]
     }, {
      value: 'navigation',
      label: 'Navigation',
      children: [{
       value: 'menu',
       label: 'NavMenu 導(dǎo)航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標(biāo)簽頁(yè)'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對(duì)話框'
      }, {
       value: 'tooltip',
       label: 'Tooltip 文字提示'
      }, {
       value: 'popover',
       label: 'Popover 彈出框'
      }, {
       value: 'card',
       label: 'Card 卡片'
      }, {
       value: 'carousel',
       label: 'Carousel 走馬燈'
      }, {
       value: 'collapse',
       label: 'Collapse 折疊面板'
      }]
     }]
    }, {
     value: 'ziyuan',
     label: '資源',
     children: [{
      value: 'axure',
      label: 'Axure Components'
     }, {
      value: 'sketch',
      label: 'Sketch Templates'
     }, {
      value: 'jiaohu',
      label: '組件交互文檔'
     }]
    }]
   };
  }
 };
</script>

多選

<div class="block">
 <span class="demonstration">默認(rèn)顯示所有Tag</span>
 <el-cascader
  :options="options"
  :props="props"
  clearable></el-cascader>
</div>
<div class="block">
 <span class="demonstration">折疊展示Tag</span>
 <el-cascader
  :options="options"
  :props="props"
  collapse-tags
  clearable></el-cascader>
</div>

<script>
 export default {
  data() {
   return {
    props: { multiple: true },
    options: [{
     value: 1,
     label: '東南',
     children: [{
      value: 2,
      label: '上海',
      children: [
       { value: 3, label: '普陀' },
       { value: 4, label: '黃埔' },
       { value: 5, label: '徐匯' }
      ]
     }, {
      value: 7,
      label: '江蘇',
      children: [
       { value: 8, label: '南京' },
       { value: 9, label: '蘇州' },
       { value: 10, label: '無(wú)錫' }
      ]
     }, {
      value: 12,
      label: '浙江',
      children: [
       { value: 13, label: '杭州' },
       { value: 14, label: '寧波' },
       { value: 15, label: '嘉興' }
      ]
     }]
    }, {
     value: 17,
     label: '西北',
     children: [{
      value: 18,
      label: '陜西',
      children: [
       { value: 19, label: '西安' },
       { value: 20, label: '延安' }
      ]
     }, {
      value: 21,
      label: '新疆維吾爾族自治區(qū)',
      children: [
       { value: 22, label: '烏魯木齊' },
       { value: 23, label: '克拉瑪依' }
      ]
     }]
    }]
   };
  }
 };
</script>

選擇任意一級(jí)選項(xiàng)

<div class="block">
 <span class="demonstration">單選選擇任意一級(jí)選項(xiàng)</span>
 <el-cascader
  :options="options"
  :props="{ checkStrictly: true }"
  clearable></el-cascader>
</div>
<div class="block">
 <span class="demonstration">多選選擇任意一級(jí)選項(xiàng)</span>
 <el-cascader
  :options="options"
  :props="{ multiple: true, checkStrictly: true }"
  clearable></el-cascader>
</div>

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計(jì)原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導(dǎo)航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導(dǎo)航'
      }]
     }]
    }, {
     value: 'zujian',
     label: '組件',
     children: [{
      value: 'basic',
      label: 'Basic',
      children: [{
       value: 'layout',
       label: 'Layout 布局'
      }, {
       value: 'color',
       label: 'Color 色彩'
      }, {
       value: 'typography',
       label: 'Typography 字體'
      }, {
       value: 'icon',
       label: 'Icon 圖標(biāo)'
      }, {
       value: 'button',
       label: 'Button 按鈕'
      }]
     }, {
      value: 'form',
      label: 'Form',
      children: [{
       value: 'radio',
       label: 'Radio 單選框'
      }, {
       value: 'checkbox',
       label: 'Checkbox 多選框'
      }, {
       value: 'input',
       label: 'Input 輸入框'
      }, {
       value: 'input-number',
       label: 'InputNumber 計(jì)數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級(jí)聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開(kāi)關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時(shí)間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時(shí)間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評(píng)分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標(biāo)簽'
      }, {
       value: 'progress',
       label: 'Progress 進(jìn)度條'
      }, {
       value: 'tree',
       label: 'Tree 樹(shù)形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁(yè)'
      }, {
       value: 'badge',
       label: 'Badge 標(biāo)記'
      }]
     }, {
      value: 'notice',
      label: 'Notice',
      children: [{
       value: 'alert',
       label: 'Alert 警告'
      }, {
       value: 'loading',
       label: 'Loading 加載'
      }, {
       value: 'message',
       label: 'Message 消息提示'
      }, {
       value: 'message-box',
       label: 'MessageBox 彈框'
      }, {
       value: 'notification',
       label: 'Notification 通知'
      }]
     }, {
      value: 'navigation',
      label: 'Navigation',
      children: [{
       value: 'menu',
       label: 'NavMenu 導(dǎo)航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標(biāo)簽頁(yè)'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對(duì)話框'
      }, {
       value: 'tooltip',
       label: 'Tooltip 文字提示'
      }, {
       value: 'popover',
       label: 'Popover 彈出框'
      }, {
       value: 'card',
       label: 'Card 卡片'
      }, {
       value: 'carousel',
       label: 'Carousel 走馬燈'
      }, {
       value: 'collapse',
       label: 'Collapse 折疊面板'
      }]
     }]
    }, {
     value: 'ziyuan',
     label: '資源',
     children: [{
      value: 'axure',
      label: 'Axure Components'
     }, {
      value: 'sketch',
      label: 'Sketch Templates'
     }, {
      value: 'jiaohu',
      label: '組件交互文檔'
     }]
    }]
   };
  }
 };
</script>

動(dòng)態(tài)加載

<el-cascader :props="props"></el-cascader>

<script>
 let id = 0;

 export default {
  data() {
   return {
    props: {
     lazy: true,
     lazyLoad (node, resolve) {
      const { level } = node;
      setTimeout(() => {
       const nodes = Array.from({ length: level + 1 })
        .map(item => ({
         value: ++id,
         label: `選項(xiàng)${id}`,
         leaf: level >= 2
        }));
       // 通過(guò)調(diào)用resolve將子節(jié)點(diǎn)數(shù)據(jù)返回,通知組件數(shù)據(jù)加載完成
       resolve(nodes);
      }, 1000);
     }
    }
   };
  }
 };

可搜索

<div class="block">
 <span class="demonstration">單選可搜索</span>
 <el-cascader
  placeholder="試試搜索:指南"
  :options="options"
  filterable></el-cascader>
</div>
<div class="block">
 <span class="demonstration">多選可搜索</span>
 <el-cascader
  placeholder="試試搜索:指南"
  :options="options"
  :props="{ multiple: true }"
  filterable></el-cascader>
</div>

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計(jì)原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導(dǎo)航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導(dǎo)航'
      }]
     }]
    }, {
     value: 'zujian',
     label: '組件',
     children: [{
      value: 'basic',
      label: 'Basic',
      children: [{
       value: 'layout',
       label: 'Layout 布局'
      }, {
       value: 'color',
       label: 'Color 色彩'
      }, {
       value: 'typography',
       label: 'Typography 字體'
      }, {
       value: 'icon',
       label: 'Icon 圖標(biāo)'
      }, {
       value: 'button',
       label: 'Button 按鈕'
      }]
     }, {
      value: 'form',
      label: 'Form',
      children: [{
       value: 'radio',
       label: 'Radio 單選框'
      }, {
       value: 'checkbox',
       label: 'Checkbox 多選框'
      }, {
       value: 'input',
       label: 'Input 輸入框'
      }, {
       value: 'input-number',
       label: 'InputNumber 計(jì)數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級(jí)聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開(kāi)關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時(shí)間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時(shí)間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評(píng)分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標(biāo)簽'
      }, {
       value: 'progress',
       label: 'Progress 進(jìn)度條'
      }, {
       value: 'tree',
       label: 'Tree 樹(shù)形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁(yè)'
      }, {
       value: 'badge',
       label: 'Badge 標(biāo)記'
      }]
     }, {
      value: 'notice',
      label: 'Notice',
      children: [{
       value: 'alert',
       label: 'Alert 警告'
      }, {
       value: 'loading',
       label: 'Loading 加載'
      }, {
       value: 'message',
       label: 'Message 消息提示'
      }, {
       value: 'message-box',
       label: 'MessageBox 彈框'
      }, {
       value: 'notification',
       label: 'Notification 通知'
      }]
     }, {
      value: 'navigation',
      label: 'Navigation',
      children: [{
       value: 'menu',
       label: 'NavMenu 導(dǎo)航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標(biāo)簽頁(yè)'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對(duì)話框'
      }, {
       value: 'tooltip',
       label: 'Tooltip 文字提示'
      }, {
       value: 'popover',
       label: 'Popover 彈出框'
      }, {
       value: 'card',
       label: 'Card 卡片'
      }, {
       value: 'carousel',
       label: 'Carousel 走馬燈'
      }, {
       value: 'collapse',
       label: 'Collapse 折疊面板'
      }]
     }]
    }, {
     value: 'ziyuan',
     label: '資源',
     children: [{
      value: 'axure',
      label: 'Axure Components'
     }, {
      value: 'sketch',
      label: 'Sketch Templates'
     }, {
      value: 'jiaohu',
      label: '組件交互文檔'
     }]
    }]
   };
  }
 };
</script>

自定義節(jié)點(diǎn)內(nèi)容

<el-cascader :options="options">
 <template slot-scope="{ node, data }">
  <span>{{ data.label }}</span>
  <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
 </template>
</el-cascader>

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計(jì)原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導(dǎo)航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導(dǎo)航'
      }]
     }]
    }, {
     value: 'zujian',
     label: '組件',
     children: [{
      value: 'basic',
      label: 'Basic',
      children: [{
       value: 'layout',
       label: 'Layout 布局'
      }, {
       value: 'color',
       label: 'Color 色彩'
      }, {
       value: 'typography',
       label: 'Typography 字體'
      }, {
       value: 'icon',
       label: 'Icon 圖標(biāo)'
      }, {
       value: 'button',
       label: 'Button 按鈕'
      }]
     }, {
      value: 'form',
      label: 'Form',
      children: [{
       value: 'radio',
       label: 'Radio 單選框'
      }, {
       value: 'checkbox',
       label: 'Checkbox 多選框'
      }, {
       value: 'input',
       label: 'Input 輸入框'
      }, {
       value: 'input-number',
       label: 'InputNumber 計(jì)數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級(jí)聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開(kāi)關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時(shí)間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時(shí)間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評(píng)分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標(biāo)簽'
      }, {
       value: 'progress',
       label: 'Progress 進(jìn)度條'
      }, {
       value: 'tree',
       label: 'Tree 樹(shù)形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁(yè)'
      }, {
       value: 'badge',
       label: 'Badge 標(biāo)記'
      }]
     }, {
      value: 'notice',
      label: 'Notice',
      children: [{
       value: 'alert',
       label: 'Alert 警告'
      }, {
       value: 'loading',
       label: 'Loading 加載'
      }, {
       value: 'message',
       label: 'Message 消息提示'
      }, {
       value: 'message-box',
       label: 'MessageBox 彈框'
      }, {
       value: 'notification',
       label: 'Notification 通知'
      }]
     }, {
      value: 'navigation',
      label: 'Navigation',
      children: [{
       value: 'menu',
       label: 'NavMenu 導(dǎo)航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標(biāo)簽頁(yè)'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對(duì)話框'
      }, {
       value: 'tooltip',
       label: 'Tooltip 文字提示'
      }, {
       value: 'popover',
       label: 'Popover 彈出框'
      }, {
       value: 'card',
       label: 'Card 卡片'
      }, {
       value: 'carousel',
       label: 'Carousel 走馬燈'
      }, {
       value: 'collapse',
       label: 'Collapse 折疊面板'
      }]
     }]
    }, {
     value: 'ziyuan',
     label: '資源',
     children: [{
      value: 'axure',
      label: 'Axure Components'
     }, {
      value: 'sketch',
      label: 'Sketch Templates'
     }, {
      value: 'jiaohu',
      label: '組件交互文檔'
     }]
    }]
   }
  }
 }
</script>

級(jí)聯(lián)面板

<el-cascader-panel :options="options"></el-cascader-panel>

<script>
export default {
data() {
 return {
  options: [{
   value: 'zhinan',
   label: '指南',
   children: [{
    value: 'shejiyuanze',
    label: '設(shè)計(jì)原則',
    children: [{
     value: 'yizhi',
     label: '一致'
    }, {
     value: 'fankui',
     label: '反饋'
    }, {
     value: 'xiaolv',
     label: '效率'
    }, {
     value: 'kekong',
     label: '可控'
    }]
   }, {
    value: 'daohang',
    label: '導(dǎo)航',
    children: [{
     value: 'cexiangdaohang',
     label: '側(cè)向?qū)Ш?
    }, {
     value: 'dingbudaohang',
     label: '頂部導(dǎo)航'
    }]
   }]
  }, {
   value: 'zujian',
   label: '組件',
   children: [{
    value: 'basic',
    label: 'Basic',
    children: [{
     value: 'layout',
     label: 'Layout 布局'
    }, {
     value: 'color',
     label: 'Color 色彩'
    }, {
     value: 'typography',
     label: 'Typography 字體'
    }, {
     value: 'icon',
     label: 'Icon 圖標(biāo)'
    }, {
     value: 'button',
     label: 'Button 按鈕'
    }]
   }, {
    value: 'form',
    label: 'Form',
    children: [{
     value: 'radio',
     label: 'Radio 單選框'
    }, {
     value: 'checkbox',
     label: 'Checkbox 多選框'
    }, {
     value: 'input',
     label: 'Input 輸入框'
    }, {
     value: 'input-number',
     label: 'InputNumber 計(jì)數(shù)器'
    }, {
     value: 'select',
     label: 'Select 選擇器'
    }, {
     value: 'cascader',
     label: 'Cascader 級(jí)聯(lián)選擇器'
    }, {
     value: 'switch',
     label: 'Switch 開(kāi)關(guān)'
    }, {
     value: 'slider',
     label: 'Slider 滑塊'
    }, {
     value: 'time-picker',
     label: 'TimePicker 時(shí)間選擇器'
    }, {
     value: 'date-picker',
     label: 'DatePicker 日期選擇器'
    }, {
     value: 'datetime-picker',
     label: 'DateTimePicker 日期時(shí)間選擇器'
    }, {
     value: 'upload',
     label: 'Upload 上傳'
    }, {
     value: 'rate',
     label: 'Rate 評(píng)分'
    }, {
     value: 'form',
     label: 'Form 表單'
    }]
   }, {
    value: 'data',
    label: 'Data',
    children: [{
     value: 'table',
     label: 'Table 表格'
    }, {
     value: 'tag',
     label: 'Tag 標(biāo)簽'
    }, {
     value: 'progress',
     label: 'Progress 進(jìn)度條'
    }, {
     value: 'tree',
     label: 'Tree 樹(shù)形控件'
    }, {
     value: 'pagination',
     label: 'Pagination 分頁(yè)'
    }, {
     value: 'badge',
     label: 'Badge 標(biāo)記'
    }]
   }, {
    value: 'notice',
    label: 'Notice',
    children: [{
     value: 'alert',
     label: 'Alert 警告'
    }, {
     value: 'loading',
     label: 'Loading 加載'
    }, {
     value: 'message',
     label: 'Message 消息提示'
    }, {
     value: 'message-box',
     label: 'MessageBox 彈框'
    }, {
     value: 'notification',
     label: 'Notification 通知'
    }]
   }, {
    value: 'navigation',
    label: 'Navigation',
    children: [{
     value: 'menu',
     label: 'NavMenu 導(dǎo)航菜單'
    }, {
     value: 'tabs',
     label: 'Tabs 標(biāo)簽頁(yè)'
    }, {
     value: 'breadcrumb',
     label: 'Breadcrumb 面包屑'
    }, {
     value: 'dropdown',
     label: 'Dropdown 下拉菜單'
    }, {
     value: 'steps',
     label: 'Steps 步驟條'
    }]
   }, {
    value: 'others',
    label: 'Others',
    children: [{
     value: 'dialog',
     label: 'Dialog 對(duì)話框'
    }, {
     value: 'tooltip',
     label: 'Tooltip 文字提示'
    }, {
     value: 'popover',
     label: 'Popover 彈出框'
    }, {
     value: 'card',
     label: 'Card 卡片'
    }, {
     value: 'carousel',
     label: 'Carousel 走馬燈'
    }, {
     value: 'collapse',
     label: 'Collapse 折疊面板'
    }]
   }]
  }, {
   value: 'ziyuan',
   label: '資源',
   children: [{
    value: 'axure',
    label: 'Axure Components'
   }, {
    value: 'sketch',
    label: 'Sketch Templates'
   }, {
    value: 'jiaohu',
    label: '組件交互文檔'
   }]
  }]
 };
}
};
</script>

Cascader Attributes


Cascader Events

Cascader Slots

CascaderPanel Attributes

CascaderPanel Events

CascaderPanel Slots

Props


到此這篇關(guān)于Element Cascader 級(jí)聯(lián)選擇器的使用示例的文章就介紹到這了,更多相關(guān)Element Cascader 級(jí)聯(lián)選擇器內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

肥东县| 盐津县| 浮山县| 黎川县| 宿迁市| 侯马市| 股票| 昆山市| 张家港市| 五家渠市| 同仁县| 青铜峡市| 龙陵县| 张家界市| 海伦市| 游戏| 平乐县| 辉南县| 临夏县| 漳浦县| 峨山| 民丰县| 莒南县| 全南县| 吴旗县| 山阳县| 贵溪市| 龙井市| 沧州市| 武宣县| 河西区| 永泰县| 阜康市| 扎鲁特旗| 西乡县| 孟津县| 凌云县| 巍山| 泗洪县| 永顺县| 新乐市|