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 adjusted some features and configuration items compared to v2 to better support Vue 3's new features. The following are the changes to consider 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. 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 binds the FormCreate instance.
vue
<form-create v-model:api="api" :rule="rule" />
  • Modified value.sync to v-model: Vue 3 no longer uses the sync modifier; use v-model directly 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). Migrate to other supported UI frameworks such as Element Plus, Ant Design Vue, etc.

  • Removed template component generation method: The template method has been removed in v3. Use JSX or functional components to generate dynamic components.

  • Removed formCreate.init method: The formCreate.init method has been removed in v3. Manage all initialization operations using Vue component lifecycle hooks.

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