Giter Club home page Giter Club logo

Comments (3)

lsm2208911 avatar lsm2208911 commented on May 29, 2024

第一步:

<form-create name="form" v-model="fApi" :rule="rule" :option="option" :value.sync="value"></form-create>

form-create组件上添加name属性, 然后 remoteMethod 就可以通过 formCreate.getApi('form')可以获取API

from form-create.

lsm2208911 avatar lsm2208911 commented on May 29, 2024

第二步:
使用form-create组件的全局API fetch,去远程搜索,具体代码:

 formCreate.fetch({
      action: 'http://localhost:8073/getSchools?currentPage=1&pageSize=10&name=' + query,
      onSuccess: function(resp){
        const list =  resp.data.map(item => {
            return {
                value: item.userId,
                label: item.departName
            }
        })
        api.updateRule('schoolId', {
          options: list
        })
      }
    })
  }

from form-create.

lsm2208911 avatar lsm2208911 commented on May 29, 2024

json:

"remoteMethod": " function(query) {\n const api = formCreate.getApi('form')\n formCreate.fetch({\n action: 'http://localhost:18073/getSchools?currentPage=1&pageSize=10&name=' + query,\n onSuccess: function(resp){\n  const list = resp.data.map(item => {\n return {\n value: item.userId,\n label: item.departName\n }\n })\n api.updateRule('schoolId', {\n options: list\n })\n }\n })\n }"

就是看起来很费劲,如果有更好的显示请告诉我!

from form-create.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.