欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

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

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

基礎(chǔ)用法

<div class="block">
 <span class="demonstration">默認 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è)計原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導航'
      }]
     }]
    }, {
     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 圖標'
      }, {
       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 計數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標簽'
      }, {
       value: 'progress',
       label: 'Progress 進度條'
      }, {
       value: 'tree',
       label: 'Tree 樹形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁'
      }, {
       value: 'badge',
       label: 'Badge 標記'
      }]
     }, {
      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 導航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標簽頁'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對話框'
      }, {
       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>

禁用選項

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

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     disabled: true,
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導航'
      }]
     }]
    }, {
     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 圖標'
      }, {
       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 計數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標簽'
      }, {
       value: 'progress',
       label: 'Progress 進度條'
      }, {
       value: 'tree',
       label: 'Tree 樹形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁'
      }, {
       value: 'badge',
       label: 'Badge 標記'
      }]
     }, {
      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 導航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標簽頁'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對話框'
      }, {
       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è)計原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導航'
      }]
     }]
    }, {
     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 圖標'
      }, {
       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 計數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標簽'
      }, {
       value: 'progress',
       label: 'Progress 進度條'
      }, {
       value: 'tree',
       label: 'Tree 樹形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁'
      }, {
       value: 'badge',
       label: 'Badge 標記'
      }]
     }, {
      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 導航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標簽頁'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對話框'
      }, {
       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" :show-all-levels="false"></el-cascader>

<script>
 export default {
  data() {
   return {
    options: [{
     value: 'zhinan',
     label: '指南',
     children: [{
      value: 'shejiyuanze',
      label: '設(shè)計原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導航'
      }]
     }]
    }, {
     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 圖標'
      }, {
       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 計數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標簽'
      }, {
       value: 'progress',
       label: 'Progress 進度條'
      }, {
       value: 'tree',
       label: 'Tree 樹形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁'
      }, {
       value: 'badge',
       label: 'Badge 標記'
      }]
     }, {
      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 導航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標簽頁'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對話框'
      }, {
       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">默認顯示所有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: '無錫' }
      ]
     }, {
      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>

選擇任意一級選項

<div class="block">
 <span class="demonstration">單選選擇任意一級選項</span>
 <el-cascader
  :options="options"
  :props="{ checkStrictly: true }"
  clearable></el-cascader>
</div>
<div class="block">
 <span class="demonstration">多選選擇任意一級選項</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è)計原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導航'
      }]
     }]
    }, {
     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 圖標'
      }, {
       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 計數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標簽'
      }, {
       value: 'progress',
       label: 'Progress 進度條'
      }, {
       value: 'tree',
       label: 'Tree 樹形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁'
      }, {
       value: 'badge',
       label: 'Badge 標記'
      }]
     }, {
      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 導航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標簽頁'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對話框'
      }, {
       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>

動態(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: `選項${id}`,
         leaf: level >= 2
        }));
       // 通過調(diào)用resolve將子節(jié)點數(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è)計原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導航'
      }]
     }]
    }, {
     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 圖標'
      }, {
       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 計數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標簽'
      }, {
       value: 'progress',
       label: 'Progress 進度條'
      }, {
       value: 'tree',
       label: 'Tree 樹形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁'
      }, {
       value: 'badge',
       label: 'Badge 標記'
      }]
     }, {
      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 導航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標簽頁'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對話框'
      }, {
       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é)點內(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è)計原則',
      children: [{
       value: 'yizhi',
       label: '一致'
      }, {
       value: 'fankui',
       label: '反饋'
      }, {
       value: 'xiaolv',
       label: '效率'
      }, {
       value: 'kekong',
       label: '可控'
      }]
     }, {
      value: 'daohang',
      label: '導航',
      children: [{
       value: 'cexiangdaohang',
       label: '側(cè)向?qū)Ш?
      }, {
       value: 'dingbudaohang',
       label: '頂部導航'
      }]
     }]
    }, {
     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 圖標'
      }, {
       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 計數(shù)器'
      }, {
       value: 'select',
       label: 'Select 選擇器'
      }, {
       value: 'cascader',
       label: 'Cascader 級聯(lián)選擇器'
      }, {
       value: 'switch',
       label: 'Switch 開關(guān)'
      }, {
       value: 'slider',
       label: 'Slider 滑塊'
      }, {
       value: 'time-picker',
       label: 'TimePicker 時間選擇器'
      }, {
       value: 'date-picker',
       label: 'DatePicker 日期選擇器'
      }, {
       value: 'datetime-picker',
       label: 'DateTimePicker 日期時間選擇器'
      }, {
       value: 'upload',
       label: 'Upload 上傳'
      }, {
       value: 'rate',
       label: 'Rate 評分'
      }, {
       value: 'form',
       label: 'Form 表單'
      }]
     }, {
      value: 'data',
      label: 'Data',
      children: [{
       value: 'table',
       label: 'Table 表格'
      }, {
       value: 'tag',
       label: 'Tag 標簽'
      }, {
       value: 'progress',
       label: 'Progress 進度條'
      }, {
       value: 'tree',
       label: 'Tree 樹形控件'
      }, {
       value: 'pagination',
       label: 'Pagination 分頁'
      }, {
       value: 'badge',
       label: 'Badge 標記'
      }]
     }, {
      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 導航菜單'
      }, {
       value: 'tabs',
       label: 'Tabs 標簽頁'
      }, {
       value: 'breadcrumb',
       label: 'Breadcrumb 面包屑'
      }, {
       value: 'dropdown',
       label: 'Dropdown 下拉菜單'
      }, {
       value: 'steps',
       label: 'Steps 步驟條'
      }]
     }, {
      value: 'others',
      label: 'Others',
      children: [{
       value: 'dialog',
       label: 'Dialog 對話框'
      }, {
       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>

級聯(lián)面板

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

<script>
export default {
data() {
 return {
  options: [{
   value: 'zhinan',
   label: '指南',
   children: [{
    value: 'shejiyuanze',
    label: '設(shè)計原則',
    children: [{
     value: 'yizhi',
     label: '一致'
    }, {
     value: 'fankui',
     label: '反饋'
    }, {
     value: 'xiaolv',
     label: '效率'
    }, {
     value: 'kekong',
     label: '可控'
    }]
   }, {
    value: 'daohang',
    label: '導航',
    children: [{
     value: 'cexiangdaohang',
     label: '側(cè)向?qū)Ш?
    }, {
     value: 'dingbudaohang',
     label: '頂部導航'
    }]
   }]
  }, {
   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 圖標'
    }, {
     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 計數(shù)器'
    }, {
     value: 'select',
     label: 'Select 選擇器'
    }, {
     value: 'cascader',
     label: 'Cascader 級聯(lián)選擇器'
    }, {
     value: 'switch',
     label: 'Switch 開關(guān)'
    }, {
     value: 'slider',
     label: 'Slider 滑塊'
    }, {
     value: 'time-picker',
     label: 'TimePicker 時間選擇器'
    }, {
     value: 'date-picker',
     label: 'DatePicker 日期選擇器'
    }, {
     value: 'datetime-picker',
     label: 'DateTimePicker 日期時間選擇器'
    }, {
     value: 'upload',
     label: 'Upload 上傳'
    }, {
     value: 'rate',
     label: 'Rate 評分'
    }, {
     value: 'form',
     label: 'Form 表單'
    }]
   }, {
    value: 'data',
    label: 'Data',
    children: [{
     value: 'table',
     label: 'Table 表格'
    }, {
     value: 'tag',
     label: 'Tag 標簽'
    }, {
     value: 'progress',
     label: 'Progress 進度條'
    }, {
     value: 'tree',
     label: 'Tree 樹形控件'
    }, {
     value: 'pagination',
     label: 'Pagination 分頁'
    }, {
     value: 'badge',
     label: 'Badge 標記'
    }]
   }, {
    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 導航菜單'
    }, {
     value: 'tabs',
     label: 'Tabs 標簽頁'
    }, {
     value: 'breadcrumb',
     label: 'Breadcrumb 面包屑'
    }, {
     value: 'dropdown',
     label: 'Dropdown 下拉菜單'
    }, {
     value: 'steps',
     label: 'Steps 步驟條'
    }]
   }, {
    value: 'others',
    label: 'Others',
    children: [{
     value: 'dialog',
     label: 'Dialog 對話框'
    }, {
     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 級聯(lián)選擇器的使用示例的文章就介紹到這了,更多相關(guān)Element Cascader 級聯(lián)選擇器內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • vue小圖標favicon不顯示的解決方案

    vue小圖標favicon不顯示的解決方案

    本篇文章主要介紹了vue小圖標favicon不顯示的解決方案,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-09-09
  • Vue中判斷語句與循環(huán)語句基礎(chǔ)用法及v-if和v-for的注意事項詳解

    Vue中判斷語句與循環(huán)語句基礎(chǔ)用法及v-if和v-for的注意事項詳解

    在Vue指令中,最經(jīng)常被用于做邏輯操作的指令,下面這篇文章主要給大家介紹了關(guān)于Vue中判斷語句與循環(huán)語句基礎(chǔ)用法及v-if和v-for注意事項的相關(guān)資料,文中通過圖文介紹的非常詳細,需要的朋友可以參考下
    2022-08-08
  • Vue?3?表格時間監(jiān)控與動態(tài)后端請求觸發(fā)詳解?附Demo展示

    Vue?3?表格時間監(jiān)控與動態(tài)后端請求觸發(fā)詳解?附Demo展示

    在Vue3中,使用el-table組件渲染表格數(shù)據(jù),通過el-table-column指定內(nèi)容,時間點需前端校準,用getTime()比較,到達時觸發(fā)操作,異步API請求可用async/await處理,setInterval實現(xiàn)定時監(jiān)控,配合條件判斷防止重復請求
    2024-09-09
  • Vue3中vue-router的使用方法詳解

    Vue3中vue-router的使用方法詳解

    Vue?Router?是?Vue?的官方路由,它與?Vue.js?核心深度集成,讓用?Vue.js?構(gòu)建單頁應用變得輕而易舉,本文將通過簡單的示例為大家介紹一下vue-router的使用,需要的可以參考一下
    2023-06-06
  • Vue中關(guān)于computed計算屬性的妙用

    Vue中關(guān)于computed計算屬性的妙用

    這篇文章主要介紹了Vue中關(guān)于computed計算屬性的妙用,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-11-11
  • VUE使用vue?create命令創(chuàng)建vue2.0項目的全過程

    VUE使用vue?create命令創(chuàng)建vue2.0項目的全過程

    vue-cli是創(chuàng)建Vue項目的一個腳手架工具,vue-cli提供了vue create等命令,下面這篇文章主要給大家介紹了關(guān)于VUE使用vue?create命令創(chuàng)建vue2.0項目的相關(guān)資料,文中通過圖文介紹的非常詳細,需要的朋友可以參考下
    2022-07-07
  • electron踩坑之remote of undefined的解決

    electron踩坑之remote of undefined的解決

    這篇文章主要介紹了electron踩坑之remote of undefined的解決,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-10-10
  • Vue中的情侶屬性$dispatch和$broadcast詳解

    Vue中的情侶屬性$dispatch和$broadcast詳解

    這篇文章主要給大家介紹了關(guān)于Vue中情侶屬性$dispatch和$broadcast的相關(guān)資料,文中通過示例代碼以及圖文介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧
    2019-03-03
  • 利用vue+elementUI設(shè)置省市縣三級聯(lián)動下拉列表框的詳細過程

    利用vue+elementUI設(shè)置省市縣三級聯(lián)動下拉列表框的詳細過程

    在做電商項目的時候需要添加修改收貨地址,如何實現(xiàn)三級聯(lián)動選取省市區(qū)地址困擾了我不少時間,這篇文章主要給大家介紹了關(guān)于利用vue+elementUI設(shè)置省市縣三級聯(lián)動下拉列表框的相關(guān)資料,需要的朋友可以參考下
    2022-08-08
  • vue3中hooks的簡介及用法教程

    vue3中hooks的簡介及用法教程

    vue3 中的 hooks 就是函數(shù)的一種寫法,就是將文件的一些單獨功能的js代碼進行抽離出來,放到單獨的js文件中,或者說是一些可以復用的公共方法/功能,這篇文章主要介紹了vue3中hooks的簡介及用法,需要的朋友可以參考下
    2023-01-01

最新評論