npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-aipage-widget

v1.2.8

Published

aipage-editor自定义组件注册器(支持react和vue3.0技术栈),用于注册自定义渲染器和插件

Downloads

234

Readme

vue3-aipage-widget

开发aipage-editor自定义组件的工具集(支持react、vue3.0技术栈)

  • 提供注册 aipage-editor 自定义插件和渲染器的方法;
  • 目前支持的技术栈:react、vue3.0技术栈,vue2.0自定义组件请使用aipage-widget
  • 备注: 同一个应用禁止同时使用 vue3-aipage-widget 和 aipage-widget(vue2.0 和 vue3.0 不能混合使用)。

提供的方法

  • registerRenderer: 注册 aipage-editor 自定义渲染器
  • registerPlugin: 注册 aipage-editor 自定义插件(在组件物料面板展示)

在线Demo

点击访问在线Demo 【开发中】

快速使用

npm install --save vue3-aipage-widget

注册 aipage-editor 自定义渲染器

import { registerRenderer } from 'vue3-aipage-widget';
class InfoCard extends React.PureComponent {
  constructor() {
    super();
  }

  render() {
    const { componentProperties, id } = this.props;
    const { data = {}, style = {} } = componentProperties || {};
    const classes = getClasses(this.props);

    return (
      <div className="react-widget">
        xxxx
      </div>
    );
  }
}
// 注册aipage-editor渲染器
registerRenderer(InfoCard, {
  type: 'react-info-card',
  framework: 'react',
});

export default InfoCard;

注册aipage-editor插件

import { registerPlugin } from 'vue3-aipage-widget';

const CustomCardsPlugin = {
  name: 'react信息卡片',
  description: '信息展示卡片',
  componentId: 'react-info-card',
  id: 'react-info-card',
  tags: ['自定义组件'], // 组件分类
  pluginIcon: 'cards-plugin',
  order: 1, // 展示顺序(从小到大展示)
  type: 'element', // 渲染器类型
  device: ['app'], // 设置类型
  docLink: '',
  demoProperties: {
    componentId: 'react-info-card',
    type: 'element',
    componentProperties: {
      data: {},
      style: {},
    },
  },
  panelControls: {
    type: 'tabs',
    tabs: [
      {
        title: '属性',
        controls: [
          {
            type: 'collapse',
            title: '数据',
            controls: [
              {
                type: 'textarea',
                name: 'title',
                label: '卡片title',
                value:
                  'amis 是一个低代码前端框架,它使用 JSON 配置来生成页面,可以减少页面开发工作量,极大提升效率。',
              },
              {
                type: 'text',
                name: 'backgroundImage',
                label: '展示图片',
                value:
                  'https://search-operate.cdn.bcebos.com/64c279f23794a831f9a8e7a4e0b722dd.jpg',
              },
              {
                type: 'input-number',
                name: 'img_count',
                label: '图片数量',
                value: 3,
              },
              {
                type: 'input-number',
                name: 'comment_count',
                label: '评论数',
                value: 2021,
              },
            ],
          },
        ],
      },
      {
        title: '外观',
        controls: [
          {
            title: '布局',
            type: 'collapse',
            controls: [
              {
                type: 'button-icon-group',
                name: 'style.display',
                label: '显示',
                value: 'block',
                options: [
                  {
                    label: '块级(block)',
                    icon: 'block',
                    value: 'block',
                  },
                  {
                    label: '行内区块(inline-block)',
                    icon: 'inlineBlock',
                    value: 'inline-block',
                  },
                  {
                    label: '行内元素(inline)',
                    icon: 'inline',
                    value: 'inline',
                  },
                ],
              },
              {
                name: 'style',
                type: 'whSet',
                label: '宽度',
                options: [
                  {
                    label: '',
                    value: 'width',
                  },
                ],
              },
            ],
          },
          {
            type: 'collapse',
            title: '边距',
            controls: {
              name: 'style.box',
              type: 'boxModel',
              label: false,
            },
          },
        ],
      },
    ],
  },
}
// 注册一个aipage-editor插件(可视化编辑器需要,会在组件面板指定分类中展示)
registerPlugin(CustomCardsPlugin);

export default CustomCardsPlugin;