Fxiaoke Developer Manual Fxiaoke Developer Manual
  • APL Development Manual
  • PWC Development Manual
  • OpenAPI Documentation
  • Custom Components (PC)
  • Custom Components (Mini Program)
  • Custom Plugins (PC)
  • Custom Plugins (Mini Program)
  • Third-party Integration Plugins (H5)
  • API (PC)
  • API (Mini Program)
  • Fx DevTools
Update Log
  • 简体中文
  • English
  • Custom Components (PC)
  • Custom Components (Mini Program)
  • Custom Plugins (PC)
  • Custom Plugins (Mini Program)
  • Third-party Integration Plugins (H5)
  • API (PC)
  • API (Mini Program)
  • Fx DevTools
Update Log
  • 简体中文
  • English
  • Getting Started

    • What is Mini Program Custom Component
    • Develop Your First Mini Program Custom Component
      • Developing Your First Mini Program Custom Component
      • Component Configuration Introduction
      • Component Upload Guide
  • Components

  • Mini Program Framework

  • Examples

Table of Contents

Developing Your First Mini Program Custom Component

# Developing Your First Mini Program Custom Component

Mini program custom components are developed using WeChat Mini Program technology. If you:

  1. Have experience with mini program development, you can start building custom components directly.
  2. Are new to mini programs, we recommend first learning the basics of mini programs (Mini Program Documentation (opens new window)) before proceeding with this guide.

# Component Configuration Introduction

Template Download Link (opens new window) – You can modify configurations directly from this template.

# 1. The config.json configuration file must exist in the directory

config.json

{  
    "components":{  
        "root": "components/demo/index"  
    },  
    "main":""  
}  
  • The components field contains your custom components, and multiple components can be uploaded simultaneously.
  • The main field exposes the plugin component for platform-side extensions.
  • There are no restrictions on the directory names or locations of your custom components and plugin files.

# 2. Creating a Simple Mini Program Component

demo/index.wxml:

<view class="container">  
    <view>Mini Program Custom Component -- Lego</view>  
</view>  

demo/index.wxss:

.container{  
  width: 300px;  
  height: 100%;  
  background:orange;  
}  

demo/index.js:

Component({  
  methods:{  
  },  
  lifetimes:{  
    attached() {  
      console.log("attached")  
    }  
  }  
});  

demo/index.json:

{  
  "component": true,  
  "usingComponents": {}  
}  

# 3. Preparing for Upload

Compress the folder containing your component into a ZIP file for upload.

For example, directly compress the cmpt folder:

first-component-step1-1

# Component Upload Guide

# Step 1: Navigate to the "Custom Components" management interface in the admin console, click "New," and upload the file

first-component-step1-1

first-component-step1-2

# Step 3: In the mobile layout designer, locate the "Custom Components" toolbox to see your component and drag it into the page layout

first-component-step2-1

# Step 4: The frontend interface will display your "First Custom Component" after loading

first-component-step3-1

What is Mini Program Custom Component
Webview Container

← What is Mini Program Custom Component Webview Container→

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式