zoukankan      html  css  js  c++  java
  • 可搜索的下拉框

    <template>
      <a-select
        show-search
        placeholder="Select a person"
        option-filter-prop="children"(这个好像不用也行)
        style=" 200px"
        :filter-option="filterOption"
        @focus="handleFocus"
        @blur="handleBlur"
        @change="handleChange"
      >
        <a-select-option value="jack">
          Jack
        </a-select-option>
        <a-select-option value="lucy">
          Lucy
        </a-select-option>
        <a-select-option value="tom">
          Tom
        </a-select-option>
      </a-select>
    </template>
    <script>
    export default {
      methods: {
        handleChange(value) {
          console.log(`selected ${value}`);
        },
        handleBlur() {
          console.log('blur');
        },
        handleFocus() {
          console.log('focus');
        },
        filterOption(input, option) {
          return (
            option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
          );
        },
      },
    };
    </script>

    参考: https://www.antdv.com/components/select-cn/#Select-

    下拉框做校验(配合from表单的 没有试过 )

    <a-select
    show-search
    placeholder="请选择对应host"
    option-filter-prop="children"
    :filter-option="filterOption"

    v-decorator="[
    'st_host',
    {
    rules: [{ required: true, message: '输入对应的host',trigger:'blur' }],
    },
    ]"
     
    style=" 100%"
    >
  • 相关阅读:
    ZOJ2913Bus Pass(BFS+set)
    HDU1242 Rescue(BFS+优先队列)
    转(havel 算法)
    ZOJ3761(并查集+树的遍历)
    ZOJ3578(Matrix)
    HDU1505
    ZOJ3574(归并排序求逆数对)
    VUE-脚手架搭建
    VUE脚手架搭建
    VUE-node.js
  • 原文地址:https://www.cnblogs.com/kaibindirver/p/13703183.html
Copyright © 2011-2022 走看看