1.0.65 • Published 3 years ago

framework4nuxt v1.0.65

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Framework4Nuxt ES6+

Framework-for-Nuxt is a better Nuxt's framework .

Framework4Nuxt 是一个专为Nuxt开发的一个前端框架。

Tips

  • 更优雅的JavaScript's Framework

  • 项目长期维护

  • Demo program is preparing Demo程序正在准备中

  • 我是SunnyXu一个PHP+JavaScript开发者 xy@ztes.com Hefei China

  • 详细文档链接 Document link

  • QQ 713001938 Email xy@ztes.com 有问题可以联系我

使用方法

  • 您的项目已经安装好了Nuxt

Install 安装

npm i framework4nuxt

Use 使用

// Create the framework.js file in the plugins folder 在plugins文件夹里创建framework.js文件

// Core Application 核心应用
import Application from "framework4nuxt"

// Structure modules 解构获得各个模块 
import {
        Container,
        Middleware,
        Pipeline, 
        Exception,
        Model,
        Service,
        ServiceProvider,
        Command,
        Transformer,
        Lib,
        Vue2Adapter,
        VuexAdapter,
        AxiosAdapter,
        UniappRequestAdapter
} from 'framework4nuxt';

// Start using 开始使用
import App from 'framework4nuxt';

// Get container instance 得到一个容器实例
const app = App.getInstance();

// Import  Vue.js 引入Vue
import Vue from 'vue';

// AppConfig is very important AppConfig 是整个框架的核心配置文件
import AppConfig from '@/app/config/AppConfig';
app.setAppConfig(AppConfig);

// Application Run 运行应用程序
app.run((services) => {
    // Services come from the framework's own providers and custom providers
    // 服务来自于框架自带providers和自定义providers
    Vue.prototype['$helper'] = services['$helper']();
});

The life cycle of framework4nuxt framework4nuxt的生命周期

  1. create Registered service providers 注册服务提供者
  2. mounted
  3. unmounted

 App.getInstance() 获取应用实例的方法

  • App.getInstance().version 获取框架版本号
  • App.getInstance().setProviders() 设置服务提供者 - 自动注册服务提供者 需在framework的run方法运行前使用
  • App.getInstance().registerProvider() 注册服务提供者
  • App.getInstance().registerProviders() 批量注册服务提供者
  • App.getInstance().setAdapter() 设置适配器
  • App.getInstance().getAdapter() 获取适配器实例
  • App.getInstance().setAppConfig() 设置APP配置
  • App.getInstance().getAppConfig() 获取APP配置
  • App.getInstance().run() 运行框架
  • App.getInstance().get('$helper') 获取容器中的对象实例 例如获取$helper

Mark

  • Pipeline Class OK 管道
  • Middleware Class OK 中间件
  • Helper Class OK 助手函数
  • ServiceProvider Class OK 服务提供者
  • RESTful Class OK 扳手工具 自动替换请求参数和携带默认值
  • Exception Class OK 扳手工具 自定义 Exception
  • Model Class OK 模型 基于Vuex
  • Transformer Class OK 转换器
  • Container Class OK 容器
  • Lib Class OK 函数库
1.0.65

3 years ago

1.0.64

3 years ago

1.0.63

3 years ago

1.0.62

3 years ago

1.0.61

3 years ago

1.0.60

3 years ago

1.0.59

3 years ago

1.0.58

3 years ago

1.0.57

3 years ago

1.0.56

3 years ago

1.0.55

3 years ago

1.0.54

3 years ago

1.0.53

3 years ago

1.0.52

3 years ago

1.0.51

3 years ago

1.0.50

3 years ago

1.0.49

3 years ago

1.0.48

3 years ago