Skip to content

Upgrade Guide

Note

FormCreate v3 is built based on Vue 3.0. Although the functionality is roughly the same as v2, there are some important changes and incompatibilities to note.

FormCreate v3 has made adjustments to some features and configuration items compared to v2 to better support Vue 3's new features. The following are the changes and adjustments to pay attention to during the v2 to v3 upgrade process.

Removed Configuration Items

In v3, the following configuration items have been removed because they are no longer applicable in Vue 3:

  • attrs: In Vue 3, it's no longer necessary to configure attrs separately, they can be handled directly in props.
  • scopedSlots: Has been replaced by slots. Vue 3 uses slot to uniformly manage slots.
  • domProps: No longer used separately, can be handled directly in props.
  • hook: Lifecycle hooks in Vue 3 have been renamed and used differently.
  • nativeOn: No longer needed, native events can be handled directly in on.
  • nativeEmit: Native events and Vue events have been unified, no longer need to distinguish, can be handled directly in emit.

Feature Adjustments

To better support Vue 3 and modern JavaScript syntax, FormCreate v3 has adjusted some features:

  • Modified return values of validate, validateField, submit:

These methods now return Promise. You can use then and catch to handle asynchronous operation results.

js
api.validate().then(() => {
    // Form validation passed
}).catch(e=>{
    // Form validation failed
});
  • Modified v-model to v-model:api: In Vue 3, v-model supports multiple parameters, so v-model:api is used to bind the FormCreate instance.
vue
<form-create v-model:api="api" :rule="rule" />
  • Modified value.sync to v-model: Vue 3 no longer uses sync modifier, directly use v-model for two-way binding.
vue
<form-create v-model="formData" :rule="rule" />

Incompatibilities

When upgrading to v3, the following features and characteristics will no longer be compatible:

  • No support for iview: v3 no longer supports iview (View UI). It is recommended to migrate to other supported UI frameworks such as Element Plus, Ant Design Vue, etc.

  • Removed template component generation method: Template method has been removed in v3. It is recommended to use JSX or functional components to generate dynamic components.

  • Removed formCreate.init method: The formCreate.init method has been removed in v3. All initialization operations are recommended to be managed using Vue component lifecycle hooks.

FormCreate is an open-source project released under the MIT License. Free for personal and commercial use.