Browse Source

添加bus更改方案(共享Vue方式)

feature/bus
Poised_flw 4 years ago
parent
commit
102beecbde
  1. 1
      src/tis_app_template_kt/public/index.html
  2. 20
      src/tis_app_template_kt/sdk/tisplatform.json
  3. 10
      src/tis_app_template_kt/src/App.vue
  4. 5
      src/tis_app_template_kt/src/components/Dialog/DialogPc.vue
  5. 9
      src/tis_app_template_kt/src/components/Dialog/dialogMixins.js
  6. 8
      src/tis_app_template_kt/src/components/LeftView.vue
  7. 12
      src/tis_app_template_kt/src/components/controlMixins.js
  8. 19
      src/tis_app_template_kt/src/main.js
  9. 5
      src/tis_app_template_kt/src/pc.vue
  10. 430
      src/tis_app_template_kt/src/tis/bus.js
  11. 38
      src/tis_app_template_kt/src/tis/index.js
  12. 5
      src/tis_app_template_kt/src/tis/layouts/BackContainer.vue
  13. 5
      src/tis_app_template_kt/src/tis/layouts/DialogContainer.vue
  14. 5
      src/tis_app_template_kt/src/tis/public-path.js

1
src/tis_app_template_kt/public/index.html

@ -23,7 +23,6 @@
<%=process.env.NODE_ENV==='production' ?
'<script src="/TIS_LIB/vue/vue.js"></script>'+
'<script src="/TIS_LIB/tis-ui/index.js"></script>' :
'<script src="http://localhost:9902/vue/vue.js"></script>'+
'<script src="http://localhost:9902/tis-ui/index.js"></script>'%>

20
src/tis_app_template_kt/sdk/tisplatform.json

@ -16,25 +16,5 @@
"/TIS_COMPONENT_MAP2D/js/app.js"
],
"preload": false
},
"TIS_LAYERMANAGER": {
"cssFiles": [
"/TIS_LAYERMANAGER/css/app.css"
],
"jsFiles": [
"/TIS_LAYERMANAGER/js/chunk-vendors.js",
"/TIS_LAYERMANAGER/js/app.js"
],
"preload": false
},
"TIS_MGS": {
"cssFiles": [
"/TIS_MGS/css/app.css"
],
"jsFiles": [
"/TIS_MGS/js/chunk-vendors.js",
"/TIS_MGS/js/app.js"
],
"preload": false
}
}

10
src/tis_app_template_kt/src/App.vue

@ -10,6 +10,7 @@
import mobile from './Mobile';
import pad from './pad';
import pc from './pc';
import bus from './tis/bus'
export default {
name: "App",
components:{
@ -20,9 +21,12 @@
computed: {
deviceType() {
// return "mobile"
return this.$tis.getDeviceType() || "pc";
return bus.getDeviceType() || "pc";
}
}
},
created() {
console.log('pc created', bus)
}
};
</script>
@ -39,4 +43,4 @@
padding: 0;
margin: 0;
}
</style>
</style>

5
src/tis_app_template_kt/src/components/Dialog/DialogPc.vue

@ -26,6 +26,7 @@
<script>
import VueDragResize from "../vueDragResize/vue-drag-resize.vue";
import {dialogMixins} from './dialogMixins'
import bus from '../../tis/bus'
export default {
name: "DialogPc",
@ -87,7 +88,7 @@
},
onClose() {
this.centerDialogVisible = false;
this.$tis.closeComponent([this.actives]);
bus.closeComponent([this.actives]);
},
toggle() {
this.showSizeChoice = !this.showSizeChoice;
@ -126,4 +127,4 @@
.content{
flex: 1;
}
</style>
</style>

9
src/tis_app_template_kt/src/components/Dialog/dialogMixins.js

@ -1,3 +1,4 @@
import bus from '../../tis/bus'
export const dialogMixins = {
data() {
return {
@ -10,7 +11,7 @@ export const dialogMixins = {
lazy: true,
get() {
//保证新加入的被加载
const status = this.$tis.getWidgetsByType('PopupWidget').pop();
const status = bus.getWidgetsByType('PopupWidget').pop();
return status && status.then(r => r)
},
default() {
@ -24,7 +25,7 @@ export const dialogMixins = {
computed:{
actives() {
//保证打开的是激活组件
const d = this.$tis.getActivesByType("PopupWidget").pop();
const d = bus.getActivesByType("PopupWidget").pop();
if(d && d.component){
this.centerDialogVisible = true;
}
@ -33,7 +34,7 @@ export const dialogMixins = {
},
methods:{
closeDialog(){
this.$tis.closeComponent([this.actives])
bus.closeComponent([this.actives])
},
onClose(){
this.centerDialogVisible = false;
@ -42,4 +43,4 @@ export const dialogMixins = {
this.dialogVisible = flag;
},
}
}
}

8
src/tis_app_template_kt/src/components/LeftView.vue

@ -56,11 +56,11 @@
actives(){
//setTimeout
setTimeout(()=>{
const count = this.$tis.getActivesByType(this.type).length;
const count = this.bus.getActivesByType(this.type).length;
if (this.activeCache > -1 && this.activeCache < count) {
//
let index = -1;
this.$tis.getActivesByType("left").forEach(a => {
this.bus.getActivesByType("left").forEach(a => {
index = this.list.findIndex(item => {
return (item.component.name || item.component) === (a.component.name || a.component)
});
@ -71,7 +71,7 @@
});
}
this.activeCache = this.$tis.getActivesByType(this.type).length;
this.activeCache = this.bus.getActivesByType(this.type).length;
},800)
}
@ -250,4 +250,4 @@
}
}
}
</style>
</style>

12
src/tis_app_template_kt/src/components/controlMixins.js

@ -1,3 +1,4 @@
import bus from '../tis/bus'
export const controlMixins = {
data() {
@ -7,7 +8,8 @@ export const controlMixins = {
activeCache: -1,
show: true,
showRightContent: true,
type1: ''
type1: '',
bus
};
},
asyncComputed: {
@ -15,7 +17,7 @@ export const controlMixins = {
lazy: false,
async get() {
let list = [];
const lefts = this.$tis.getWidgetsByType(this.type);
const lefts = bus.getWidgetsByType(this.type);
if (lefts) {
const lfs = lefts.filter(l => l && !l.lazy);
for (let i = 0; i < lfs.length; i++) {
@ -41,7 +43,7 @@ export const controlMixins = {
},
computed: {
actives() {
return this.$tis.getActivesByType(this.type);
return bus.getActivesByType(this.type);
},
allHiddened() {
if (this.hidden.length === 0) return false;
@ -55,7 +57,7 @@ export const controlMixins = {
console.log("删除", index);
// //最小化后
this.list[index].lazy = true;
this.$tis.closeComponent([this.list[index].component]);
bus.closeComponent([this.list[index].component]);
this.activeCache > 0 ? this.activeCache-- : "";
},
onMinize(index) {
@ -103,4 +105,4 @@ export const controlMixins = {
this.active = 0;
},
},
}
}

19
src/tis_app_template_kt/src/main.js

@ -1,4 +1,5 @@
import tis, {setup} from "./tis";
import {setup} from "./tis";
import bus from './tis/bus'
import App from "./App.vue";
import EventBusExample from './components/EventBusExample'
@ -9,33 +10,33 @@ import SlideExample from './components/SlideExample.vue'
// import {registerApps} from './scriptsLoader/index'
// 生命周期函数
function bootstrap(params) {
console.log(`[SubApp: ${tis.appId}] boostrap`, params);
console.log(`[SubApp: ${bus.appId}] boostrap`, params);
}
function mount(params) {
// window.esapp = tis;
// console.log('app_demo.....',window.tisApp.Vue)
// registerApps();
console.log(`[SubApp: ${tis.appId}] mount`, params.tis);
console.log(`[SubApp: ${bus.appId}] mount`, params.tis);
}
function show(params) {
console.log(`[Template App--->: ${tis.appId}] show`, params);
tis.menuStatusUpdate();
console.log(`[Template App--->: ${bus.appId}] show`, params);
bus.menuStatusUpdate();
}
function hide(params) {
console.log(`[SubApp: ${tis.appId}] hide`, params);
console.log(`[SubApp: ${bus.appId}] hide`, params);
}
function unmount(params) {
console.log(`[SubApp: ${tis.appId}] unmount`, params);
console.log(`[SubApp: ${bus.appId}] unmount`, params);
}
// 收到消息
function onMessage(params, message) {
console.log(`我是子应用[SubApp: ${tis.appId}] onMessage`, params, message);
console.log(`我是子应用[SubApp: ${bus.appId}] onMessage`, params, message);
}
//初始化全局组件
@ -47,7 +48,7 @@ function install() {
function onMenu(menu) {
const {component} = menu;
console.log("当前被点击菜单", menu, component)
tis.openComponentByMenu(component);
bus.openComponentByMenu(component);
}
//api初始化

5
src/tis_app_template_kt/src/pc.vue

@ -31,11 +31,6 @@
visibleAppCards: true,
};
},
computed: {
list() {
return this.$tis.layout;
},
},
methods: {
login(info) {
console.log("用户名和密码", info);

430
src/tis_app_template_kt/src/tis/bus.js

@ -1,224 +1,248 @@
import Vue from "vue";
import EE from 'eventemitter3'
import axios from 'axios'
import {registerApps} from './scriptsLoader/index'
// temp
let curBaseUrl = ''
// 挂载vue的示例
let vueInstance = null
// 数据机制,考虑vuex来实现
const bus = new Vue({
data: {
components: [], // components
asserts: {},
deviceType: "pc",
actives: [],//从菜单中激活的组件,
layouts: [],//由自定义组件和第三方组件组成的布局组件集合
widgets: [],//在应用模板内部需要加载的widgets
},
methods: {
setVueInstance(instance) {
vueInstance = instance
},
getDeviceType() {
return this.deviceType
},
getTemplateLayouts(){
return this.layouts;
},
// 传递当前所处组件的上下文环境
menuStatusUpdate(){
const onActives = this.getTemplateLayouts().filter(l => !l.lazy).map(c=>c.component.name || c.component);
const appId = ''
console.log('============>', appId)
// TODO 这里通过event-bus来实现吧,Vue实例获取不到
this.$emit('TIS_TEMPLATE_MENU_ACTIVE', {appId, onActives: onActives,system:true})
},
async loadComponent(component) {
const comp = this.components.find(arg => arg.component === component) || {};
console.log('所有组件...', this.components,);
console.log('所有资源...', this.asserts);
console.log('当前加载组件...', component,);
console.log('匹配到的组件...', comp);
let assets = null;
let dependencies = [];
let isLib = false;
try {
const info = comp.segprefix;
assets = this.asserts[info];
dependencies = comp.dependencies || [];
isLib = comp.lib;
} catch (e) {
console.error(e)
}
const dev = process.env.NODE_ENV === 'development';
const baseUrl = dev ? process.env.BASE_URL : "";
let state = {
components: [], // components
asserts: {},
deviceType: "pc",
actives: [],//从菜单中激活的组件,
layouts: [],//由自定义组件和第三方组件组成的布局组件集合
widgets: [],//在应用模板内部需要加载的widgets
}
class Bus extends EE {
appId = ''
getDeviceType() {
return state.deviceType
}
getTemplateLayouts(){
return state.layouts;
}
//等待依赖下载完毕
for (const refer of dependencies) {
let reference = this.asserts[refer] || null;
await registerApps(reference, curBaseUrl);
}
return new Promise((resolve, reject) => {
//加载组件资源
console.log('开始加载组件资源', assets, curBaseUrl)
registerApps(assets, curBaseUrl).then(() => {
if (!isLib) {//正常组件的加载流程,isLib为true代表纯js lib库的加载
let startTime = new Date().getTime();
const looper = setInterval(() => {
if (Vue.component(`${component}`)) {
resolve(comp)
clearInterval(looper);
} else {
let nowTime = new Date().getTime();
if (nowTime - startTime > 2000) {
if (!assets) {
reject(`[loading error:${component}]:组件资源加载失败`)
} else {
reject(`[loading error:${component}]:loading component timed out`)
}
clearInterval(looper)
// 传递当前所处组件的上下文环境
menuStatusUpdate(){
const onActives = this.getTemplateLayouts().filter(l => !l.lazy).map(c=>c.component.name || c.component);
const appId = ''
console.log('============>', appId)
// TODO 这里通过event-bus来实现吧,Vue实例获取不到
this.emit('TIS_TEMPLATE_MENU_ACTIVE', {appId, onActives: onActives,system:true})
}
async loadComponent(component) {
const comp = state.components.find(arg => arg.component === component) || {};
console.log('所有组件...', state.components,);
console.log('所有资源...', state.asserts);
console.log('当前加载组件...', component,);
console.log('匹配到的组件...', comp);
let assets = null;
let dependencies = [];
let isLib = false;
try {
const info = comp.segprefix;
assets = state.asserts[info];
dependencies = comp.dependencies || [];
isLib = comp.lib;
} catch (e) {
console.error(e)
}
//等待依赖下载完毕
for (const refer of dependencies) {
let reference = state.asserts[refer] || null;
await registerApps(reference, curBaseUrl);
}
return new Promise((resolve, reject) => {
//加载组件资源
console.log('开始加载组件资源', assets, curBaseUrl)
registerApps(assets, curBaseUrl).then(() => {
if (!isLib) {//正常组件的加载流程,isLib为true代表纯js lib库的加载
let startTime = new Date().getTime();
const looper = setInterval(() => {
if (Vue.component(`${component}`)) {
resolve(comp)
clearInterval(looper);
} else {
let nowTime = new Date().getTime();
if (nowTime - startTime > 2000) {
if (!assets) {
reject(`[loading error:${component}]:组件资源加载失败`)
} else {
reject(`[loading error:${component}]:loading component timed out`)
}
clearInterval(looper)
}
}, 300)
} else {
resolve(comp);
}
}).catch(err => {
if (!assets) {
reject(`[loading error:${component}]:组件资源加载失败`)
} else {
reject(`[loading error:${component}]:${err}`)
}
});
})
},
//自定义函数,支持开发者按需增加接口
openComponentByMenu(components) {
//长度变化才会触发computed?
this.components.filter(c => {
const component = c.component.name || c.component;
//激活组件命中此组件,更改状态
const hit = components.includes(component);
if (hit) {
c.lazy = !hit;
return c;
}
}).forEach(c => {
if (!this.layouts.some(l => (l.component.name || l.component) === c.component)) {
this.layouts.push(c);
}else{
//改变状态
this.layouts.forEach(l => {
if((l.component.name || l.component) === c.component ){
l.lazy = false;
}
})
}, 300)
} else {
resolve(comp);
}
}).catch(err => {
if (!assets) {
reject(`[loading error:${component}]:组件资源加载失败`)
} else {
reject(`[loading error:${component}]:${err}`)
}
});
if (!this.actives.some(l => l.component === c.component)) {
//弹窗暂定为同一时间只能打开一个
if (c.type === 'dialog') {
this.actives = [c];
} else {
this.actives.push(c);
})
}
//自定义函数,支持开发者按需增加接口
openComponentByMenu(components) {
//长度变化才会触发computed?
state.components.filter(c => {
const component = c.component.name || c.component;
//激活组件命中此组件,更改状态
const hit = components.includes(component);
if (hit) {
c.lazy = !hit;
return c;
}
}).forEach(c => {
if (!state.layouts.some(l => (l.component.name || l.component) === c.component)) {
state.layouts.push(c);
}else{
//改变状态
state.layouts.forEach(l => {
if((l.component.name || l.component) === c.component ){
l.lazy = false;
}
})
}
if (!state.actives.some(l => l.component === c.component)) {
//弹窗暂定为同一时间只能打开一个
if (c.type === 'dialog') {
state.actives = [c];
} else {
state.actives.push(c);
}
});
//有 加入 无 删除?
console.log('layouts变化状态', this.layouts);
console.log('actives变化状态', this.actives);
this.menuStatusUpdate();
},
// 关闭组件
closeComponent(components) {
//修改layout中的状态
this.layouts.forEach(c => {
const component = c.component.name || c.component;
//激活组件命中此组件,更改状态
const hit = components.includes(component);
if (hit) {
c.lazy = hit;
}
});
//有 加入 无 删除?
console.log('layouts变化状态', state.layouts);
console.log('actives变化状态', state.actives);
this.menuStatusUpdate();
}
// 关闭组件
closeComponent(components) {
//修改layout中的状态
state.layouts.forEach(c => {
const component = c.component.name || c.component;
//激活组件命中此组件,更改状态
const hit = components.includes(component);
if (hit) {
c.lazy = hit;
}
})
//active中删除该组件
console.log('待删除组件', components)
components.forEach(c => {
const index = state.actives.findIndex(b => b.component === c);
console.log('aaaaaa', index);
if (index >= 0) {
state.actives.splice(index, 1);
}
})
console.log('layouts变化状态', state.layouts)
console.log('actives变化状态', state.actives)
this.menuStatusUpdate();
}
//initLayouts //layouts 初始化,外部组件
initLayouts(layouts = []) {
console.log('initLayouts', layouts, state)
state.layouts.push(...layouts.filter(l => !l.lazy))
console.log('after initLayouts', state.layouts)
}
//获取组件
getWidgetsByType(type) {
console.log('getWidgetsByType', type, state)
//以type 或 position 命中widget,背景板默认lazy=false
return state.layouts.filter(f => (f.type === type || f.position === type) && !f.lazy).map(f => {
//string类型,来自配置文件,需要下载资源才能使用,懒加载组件不加载但是需要加入到数组中、、
if (typeof f.component === "string") {
console.log('下载component资源', f.component);
return this.loadComponent(f.component);
} else {
return f
}
});
}
//获取含有当前类型的激活组件
getActivesByType(type) {
return state.actives.filter(a => a.type === type);
}
// 初始化配置信息
async initData(props) {
const dev = process.env.NODE_ENV === 'development';
curBaseUrl = props.tis ? props.tis.entry : baseUrl;
console.log('initData curBaseUrl', curBaseUrl, props)
const esData = await axios.get(`${curBaseUrl}/esplug.json`).catch(err => console.error(err));
const asserts = await axios.get(`${curBaseUrl}/tisplatform.json`).catch(err => console.error(err));
try {
//运行模式才取用框架返回的数据
if (props.tis && !dev) {
console.log('框架传入的components:',props.tis.components)
state.components = props.tis.components ? [...props.tis.components,...esData.data.components] : esData.data.components;
state.asserts = Object.keys(props.tis.asserts).length !== 0 ? props.tis.asserts : asserts.data;
state.widgets = props.tis.widgets ? props.tis.widgets : esData.data.widgets;
} else {
state.components = esData.data.components
state.asserts = asserts.data;
state.widgets = esData.data.widgets;
}
//避免不填此属性,默认懒加载
state.components = state.components.map(c => {
if (!Object.prototype.hasOwnProperty.call(c, "lazy") && c.type !== "background") {
c.lazy = true
}
return c;
})
//active中删除该组件
console.log('待删除组件', components)
components.forEach(c => {
const index = this.actives.findIndex(b => b.component === c);
console.log('aaaaaa', index);
if (index >= 0) {
this.actives.splice(index, 1);
}
} catch (e) {
console.error(e)
}
}
})
console.log('layouts变化状态', this.layouts)
console.log('actives变化状态', this.actives)
this.menuStatusUpdate();
},
//initLayouts //layouts 初始化,外部组件
initLayouts(layouts = []) {
this.layouts.push(...layouts.filter(l => !l.lazy))
},
//获取组件
getWidgetsByType(type) {
//以type 或 position 命中widget,背景板默认lazy=false
return this.layouts.filter(f => (f.type === type || f.position === type) && !f.lazy).map(f => {
//string类型,来自配置文件,需要下载资源才能使用,懒加载组件不加载但是需要加入到数组中、、
if (typeof f.component === "string") {
console.log('下载component资源', f.component);
return this.loadComponent(f.component);
} else {
return f
}
setup(options = {}) {
state.layouts = options.layout || []
}
});
},
//获取含有当前类型的激活组件
getActivesByType(type) {
return this.actives.filter(a => a.type === type);
},
// 初始化配置信息
async initData(props) {
const dev = process.env.NODE_ENV === 'development';
curBaseUrl = props.tis ? props.tis.entry : baseUrl;
const esData = await axios.get(`${curBaseUrl}/esplug.json`).catch(err => console.error(err));
const asserts = await axios.get(`${curBaseUrl}/tisplatform.json`).catch(err => console.error(err));
try {
//运行模式才取用框架返回的数据
if (props.tis && !dev) {
console.log('框架传入的components:',props.tis.components)
this.components = props.tis.components ? [...props.tis.components,...esData.data.components] : esData.data.components;
this.asserts = Object.keys(props.tis.asserts).length !== 0 ? props.tis.asserts : asserts.data;
this.widgets = props.tis.widgets ? props.tis.widgets : esData.data.widgets;
} else {
this.components = esData.data.components
this.asserts = asserts.data;
this.widgets = esData.data.widgets;
}
//避免不填此属性,默认懒加载
this.components = this.components.map(c => {
if (!Object.prototype.hasOwnProperty.call(c, "lazy") && c.type !== "background") {
c.lazy = true
}
return c;
})
} catch (e) {
console.error(e)
}
},
bootstrap(props) {
this.appId = props.tis?.appId
}
});
async mount(props = {}) {
await this.initData(props)
console.log('app frame', state.components, state.asserts, state.widgets)
this.initLayouts(state.components)
this.initLayouts(state.widgets)
}
};
Object.freeze(Bus)
const bus = new Bus()
export function unmount() {
state = null
bus = null
}
export default bus

38
src/tis_app_template_kt/src/tis/index.js

@ -1,19 +1,12 @@
const devLib = process.env.VUE_APP_DEVLIB === "dev";
console.log('当前版本======> for',process.env.VUE_APP_DEVLIB)
if (window.__POWERED_BY_QIANKUN__) {
// 注入乾坤处理过的publicPath
// eslint-disable-next-line no-undef
window.__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ + (devLib ? "/TIS_APP_TEMPLATE_KT/" : '');
}
import './public-path'
import Vue from "vue";
import store from './store'
import AsyncComputed from 'vue-async-computed'
import {registerApps} from './scriptsLoader/index'
import axios from 'axios'
import Vuex from 'vuex'
import EventBusExample from '../components/EventBusExample'
import {registerApps} from './scriptsLoader/index'
import store from './store'
import bus from './bus'
Vue.component('EventBusExample', EventBusExample)
@ -25,7 +18,6 @@ const dev = process.env.NODE_ENV === 'development';
// http://localhost:7001是一个写死的路径。。如何能正确的获取到组件的域
// 在这个文件中进行对kt的适配
const baseUrl = dev ? process.env.BASE_URL : "";
let curBaseUrl = '';
let _App,
_instance,
_options = {},
@ -35,14 +27,15 @@ let _App,
export function setup(App, options = {}) {
_App = App;
_options = options;
bus.layouts = options.layout;
bus.setup(options)
if (typeof _options.install === "function") {
_options.install(Vue);
}
// registerApps(_options.components)
// 独立运行时
if (!window.__POWERED_BY_QIANKUN__) {
Vue.prototype.$tis = bus;
// 弃用,会污染原型链
// Vue.prototype.$tis = bus;
// console.log('----------','独立运行')
mount();
}
@ -60,7 +53,10 @@ export async function bootstrap(props) {
const theme = localStorage.getItem("TIS_DESIGN_THEME") || 'default';
swithTheme(theme);
_props = props;
Vue.prototype.$tis = bus;
bus.bootstrap(props)
// 弃用,会污染原型链
//Vue.prototype.$tis = bus;
/*
Vue.prototype.$EsDataMsg = function (params = {}) {
if (typeof params.callback === "function") {
bus.$on('message', {system: true}, async (payload) => {
@ -70,7 +66,8 @@ export async function bootstrap(props) {
}
Vue.prototype.$EsOpenComponent = function () {
}
props.onMessage.ref = _options.onMessage // 暴露onMessage回调给宿主
*/
props.onMessage && (props.onMessage.ref = _options.onMessage) // 暴露onMessage回调给宿主
props.onMenu && (props.onMenu.ref = _options.onMenu) // 暴露onMessage回调给宿主
if (typeof _options.bootstrap === "function") {
_options.bootstrap(props);
@ -95,12 +92,7 @@ export async function mount(props = {}) {
// console.log('框架传来的参数', props.tis.components,props.tis.asserts)
//取得esplug
// console.log('当前运行环境',dev,'baseURL',props.tis.entry);
await bus.initData(props)
console.log('app frame', bus.components, bus.asserts);
//一些内部配置的component需要加入layouts
bus.initLayouts(bus.components);
// widgets加入layouts
bus.initLayouts(bus.widgets);
await bus.mount(props)
document.documentElement.setAttribute('data-device', "pc");
window.esapp = Object.assign({}, {
Vue: Vue,
@ -190,5 +182,3 @@ function swithTheme(param) {
container.appendChild(themeStyle);
}
export default bus;

5
src/tis_app_template_kt/src/tis/layouts/BackContainer.vue

@ -6,6 +6,7 @@
</template>
<script>
import bus from '../bus'
export default {
name: "BackContainer",
data() {
@ -17,7 +18,7 @@
BackWidget: {
lazy: true,
get() {
const p = this.$tis.getWidgetsByType('BackWidget')[0];
const p = bus.getWidgetsByType('BackWidget')[0];
return p && p.then(r => r.component)
}
},
@ -40,4 +41,4 @@
background-repeat: no-repeat;
min-height: 100vh;
}
</style>
</style>

5
src/tis_app_template_kt/src/tis/layouts/DialogContainer.vue

@ -8,13 +8,14 @@
<script>
import DialogPc from '../../components/Dialog/DialogPc'
import DialogPad from '../../components/Dialog/DialogPad'
import bus from '../bus'
export default {
name: "DialogContainer",
components:{DialogPc,DialogPad},
computed:{
deviceType(){
return this.$tis.getDeviceType();
return bus.getDeviceType();
}
}
@ -31,4 +32,4 @@
color: white;
}
}
</style>
</style>

5
src/tis_app_template_kt/src/tis/public-path.js

@ -0,0 +1,5 @@
const devLib = process.env.VUE_APP_DEVLIB === "dev";
if (window.__POWERED_BY_QIANKUN__) {
// eslint-disable-next-line no-undef
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ + (devLib ? "/TIS_APP_TEMPLATE_KT/" : '');
}
Loading…
Cancel
Save