0.0.3 • Published 1 year ago

@system-plugin/plugin-vue2 v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

插件配置接入简要说明

本插件适用于 Vue2.x 构建的应用,主要用于应用外挂插件。

preivew

接入说明

  • 前端
  1. 安装依赖
npm install @system-plugin/plugin-vue2
  1. 引入
// main.js
import DSPlatformPlugin from '@system-plugin/plugin-vue2'
import '@system-plugin/plugin-vue2/lib/ds_platform_plugin.css'
Vue.use(DSPlatformPlugin)
  1. 使用
<!-- Layout/index.vue2 -->
<template>
  <div id="Layout">
    <!-- ... -->
    <index-interpretation :token="token"  :baseUrl="baseUrl" />
  </div>
</template>

<script>
// token 及 baseUrl 请自行获取传入
import { getToken } from '@/utils/auth'
export default {
  name: 'Layout',
  data() {
    return {
      token: getToken(),
      baseUrl: '/toPlugin'
    }
  }
}
</script>
  • 后端

需要修改 nginx 配置,解析 baseUrl 到插件中心,如:

  location ^~/toPlugin {
       proxy_pass http://172.16.1.98:9999/dev-api;
       proxy_set_header Host                $host:$server_port;
       proxy_set_header X-Forwarded-For     $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto   $scheme;
       proxy_set_header X-Forwarded-Port    $server_port;
    }