Skip to content

Frame

To close a sub-page opened by the frame, call the parent page's fApi.closeModel method

Online Preview

Rules

Basic Example

js
const rule = {
    type:"frame",
    title:"Material",
    field:"fodder",
    value:["/uploads/20131030/30-075657_191.jpg?1"],
    props:{
        type:"image",
        src:"iframe.html",
        maxLength:2,


},
    validate:[
        {required:true, type: 'array', min: 2, message: 'Select 2 images', trigger: 'change'}
    ],
}

Props Configuration Examples

Image Selection

js
const rule = {
    type:"frame",
    title:"Product Images",
    field:"images",
    value:[],
    props:{
        type:"image",
        src:"/image-selector.html",
        maxLength: 9,
        width: "800px",
        height: "600px",
        modalTitle: "Select Image",
    },
}

File Selection

js
const rule = {
    type:"frame",
    title:"Attachment Upload",
    field:"files",
    value:[],
    props:{
        type:"file",
        src:"/file-selector.html",
        maxLength: 5,
        width: "900px",
        height: "500px",
    },
}

Events Examples

Listen to Selection Changes

js
const rule = {
    type:"frame",
    title:"Product Images",
    field:"images",
    value:[],
    props:{
        type:"image",
        src:"/image-selector.html",
        maxLength: 9,
        onChange: (value) => {
            console.log('Selection value changed:', value);
        },
        onOpen: () => {
            console.log('Open popup');
        },
        onOk: (value) => {
            console.log('Clicked OK:', value);
        },
    },
}

value: String | Number | Array

Props

PropertyDescriptionTypeDefault
typeFrame display type, has input(string), file(file), image(image)Stringinput
srcAddress of frame pageString-
helperEnable helper methods in frame pageBooleanfalse
disabledDisable componentBooleanfalse
iconIcon for button to open popupString-
srcKeyWhen value is Object[], need to define srcKeyString-
widthPopup widthString-
heightPopup heightString-
okBtnTextPopup OK button textString'OK'
closeBtnTextPopup close button textString'Close'
modalTitleImage preview popup title textString'Preview'
handleIconIcon for action button, set to false will not display, set to true for default preview icon, default is false when type is file, default is true when type is imageString | Boolean-
titlePopup titleString-
modalConfigure popup propsObject-
allowRemoveWhether can remove, set to false will not show remove button, effective when type equals image or fileBooleantrue
onChangeTriggered when value changesFunction-
onOpenCallback when opening popupFunction-
onOkCallback when clicking OK, return false will not close popupFunction-
onHandleClick action button event, default is image previewFunction-
onBeforeRemoveEvent before clicking remove button to remove, return false will not removeFunction-
onRemoveClick remove button eventFunction-
onCancelTriggered when popup closes, return false will not close popupFunction-

helper

When helper methods are enabled, the frame page adds a global form_create_helper variable for component operations

  • close

  • Parameters: - field Component's field

  • Description: Closes the current frame component's popup

  • Example:

    js
    form_create_helper.close(field)
  • set

  • Parameters: - field Component's field - value Component's value

  • Description: Modifies the current frame component's value

  • Example:

    js
    form_create_helper.set(field,[1,2,3])
  • get

  • Parameters: - field Component's field

  • Description: Gets the current frame component's value

  • Example:

    js
    const value = form_create_helper.get(field)

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