active-page-vue
Version:
A Vue-based visual page editor component
183 lines (135 loc) • 5.2 kB
Markdown
# active-page-vue
## 介绍
基于 Vue 2.x 的可视化页面编辑器组件。提升前端开发效率,可集成至移动端项目作为通过定义 JSON 直接生成 UI 界面的组件。
文档地址:[http://qiniu-program.juroom.cn](http://qiniu-program.juroom.cn)
在线体验:[http://qiniu-plat.juroom.cn](http://qiniu-plat.juroom.cn)
## 安装与使用
### 安装
```bash
npm install active-page-vue --save
```
### 全局注册
```js
import Vue from 'vue'
import ActivePageVue from 'active-page-vue'
Vue.use(ActivePageVue)
```
### 局部注册
```js
import { ActivePage } from 'active-page-vue'
export default {
components: {
ActivePage
}
}
```
### 基本用法
```vue
<template>
<div class="app-container">
<active-page
:enable-transition="true"
:transition-name="'slide'"
@mounted="handleMounted"
@reloaded="handleReloaded"
>
<template #before-content>
<!-- 在路由视图前插入内容 -->
<div class="header">页面头部</div>
</template>
<template #after-content>
<!-- 在路由视图后插入内容 -->
<div class="footer">页面底部</div>
</template>
</active-page>
</div>
</template>
<script>
export default {
methods: {
handleMounted() {
console.log('ActivePage组件已挂载')
},
handleReloaded() {
console.log('ActivePage组件已重新加载')
}
}
}
</script>
```
## API
### Props
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| enableTransition | 是否启用页面过渡动画 | Boolean | false |
| transitionName | 过渡动画名称 | String | 'fade' |
| containerClass | 自定义容器类名 | String/Object/Array | '' |
### 事件
| 事件名称 | 说明 | 回调参数 |
| --- | --- | --- |
| mounted | 组件挂载完成时触发 | - |
| reloaded | 页面重新加载完成时触发 | - |
### 插槽
| 插槽名称 | 说明 |
| --- | --- |
| before-content | 路由视图前的内容 |
| after-content | 路由视图后的内容 |
### 方法
通过 `ref` 可以获取到 ActivePage 实例并调用实例方法
```js
this.$refs.activePage.reload() // 重新加载页面内容
```
| 方法名 | 说明 | 参数 |
| --- | --- | --- |
| reload | 重新加载页面内容 | - |
## 本地开发
1. npm install (安装 node_modules 模块)
2. npm run serve (运行)
3. npm run build (打包)
4. npm update (用于更新包到基于规范范围的最新版本)
> 注:在新版本的npm中,默认情况下,npm install遇到冲突的peerDependencies时将失败。
> 可使用:npm install --legacy-peer-deps
#### 使用说明
##### 使用教程






##### 自定义组件可以看
```text
src / layout / home / index.vue // 编辑页面文件
src / components / sliderassembly / index.vue // 左侧组件大全文件
src / components / componentscom // 左侧组件目录
src / components / rightslider // 右侧组件目录
src / utils / componentProperties.js // 组件数据
```
#### componentProperties(组件数据)字段注解
```js
{
component: 'custommodule', // 中间部分手机组件的name
text: '自定义模块', // 组件文字描述
type: '1-14', // data-tpye
active: true, // 是否选中
style: 'custommodulestyle', // 右边组件设置的name
setStyle: {} // 组件动态数据
}
```
#### 官方生态
| 项目 | 描述 |
| --- | --- |
| [AS-Editor <br/> Vue2版](https://gitee.com/was666/as-editor) | 基于 Vue2 的 AS-Editor |
| [AS-Editor <br/> Vue3版](https://gitee.com/was666/as-editor/tree/vue3.x/) | 基于 Vue3 的 AS-Editor |
| [AS-Editor-H5](https://gitee.com/was666/as-editor-h5) | AS-Editor-H5 是移动端 Vue 模版,可以通过定义的 JSON 生成 Vue 页面 |
#### 感谢捐赠
| [有育哥](https://gitee.com/cfxp) | [邓跃辉](https://gitee.com/york8888_admin) |[hackchen](https://gitee.com/hackchen) | [狼牙](https://gitee.com/fdfgasdvdxz) | [许中杰](https://gitee.com/xu-zhongjie) |[RainbowParadise](https://gitee.com/mars728) |[神秘的凯](https://gitee.com/shenmidekai) |
|---|---|---|---|---|---|---|
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 结尾
##### 如果喜欢的话给个 star 一下哈
##### 如果有意见和问题 可以在 lssues 提出,我会在线解答