1.0.29 • Published 6 years ago

acribus v1.0.29

Weekly downloads
146
License
-
Repository
-
Last release
6 years ago

principle: Convention over configuration

only needs to specify unconventional aspects of the application by config

develop

开发分支在dev 发布分支在master the way how you look at an app

Conventions

  • state structure {moduleNameList, moduleName}
  • action name loadmoduleNameList loadmoduleName
  • field in table and editable

helpers && keywords

keywords used to trigger a predefined action or expand a predefined object

helpers used to generate config object easily

#form-tpl

how to use

 <FormTpl
    :model="formData"
    :fields="config.form"
    v-if="config.form"
    :options="{inline: true, nativeOn: {click: onSearch}}">
    <!--optional: some slot here -->
 </FormTpl>

how to write fields

fields is an array like:

[
      {
        type: 'input',
        label: 'SLS Tracking Order ID',
        key: 'sls_tracking_number',
        rule: {
          'sls_tracking_number': [{
                type: 'number',
                message: `${key} should be a number !`
              }
        }]
      },
      {
        type: 'input',
        label: 'Shopee Order SN',
        key: 'shopee_order_sn'
      },
      {
        type: 'select',
        label: 'Status',
        key: 'status',
        options: RECEIVE.STATUS.map((val, index) => ({
          value: index.toString(),
          label: val
        })),
        options: {
          on: {
            change: 'submit'
          }
        }
      },
      {
          type: 'date-picker',
          subType: 'datetimerange',
          label: 'Pick Up Time',
          key: 'pick_up_time',
          placeholder: ['start time', 'end time']
      }
   ]

writing this object by hand can be bored, so the following pattern is recommended, using helper which provided by package

new FieldInput('Email', 'email', ['required', 'email']),
new FieldInput('Phone', 'phone', true),
new FieldSelect('Status', 'status', [
   ...USER.STATUS.map((item, index) => ({
      label: item,
      value: index
   }))
], true),
new FieldMultiSelect('Role', 'role_list', () => {
   return this.roleOptions
}, true),

hint: two ways to pass options: array or function which return an array, functional way is necessary when options is dynamic

form-tpl provide many keyword to ease your writing,

options: {
   on: {
      change: 'submit'
    }
}

instand of writing function handler, form submitting can be triggered by a string 'submit'

PropertyDescriptionTypeDefault
formoptional hold the reference of form component, used to get form statusObjectnull
modelhold all the value user have inputObject{}
fieldsdefined the form inputArray[]
rulesoptional to specify the validation rules, can be written in fieldsObjectnull
optionsoptional to specify the trivial things like layoutObjectnull
1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago