Swap global vars to app config as JSON
This commit is contained in:
@@ -188,7 +188,6 @@ class Spot extends Main
|
||||
self::MAIN_PAGE,
|
||||
array(
|
||||
'language' => $this->oLang->getLanguage(),
|
||||
'filepath_css' => self::addTimestampToFilePath('spot.css'),
|
||||
'filepath_js' => self::addTimestampToFilePath('../dist/app.js'),
|
||||
),
|
||||
$asPages
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<meta name="msapplication-TileColor" content="#00a300">
|
||||
<meta name="msapplication-config" content="images/icons/browserconfig.xml?v=GvmqYyKwbb">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<script type="text/javascript">window.params = [#]GLOBAL_VARS[#];</script>
|
||||
<script id="app-config" type="application/json">[#]APP_CONFIG[#]</script>
|
||||
<title>Spotty</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -9,7 +9,6 @@ window.setElem = common.setElem;
|
||||
window.getDragPosition = common.getDragPosition;
|
||||
window.copyTextToClipboard = common.copyTextToClipboard;
|
||||
window.getOuterWidth = common.getOuterWidth;
|
||||
|
||||
import Css from './../styles/spot.scss';
|
||||
|
||||
//Masks
|
||||
@@ -18,8 +17,6 @@ import Spot from './spot.js';
|
||||
//import Upload from './page.upload.js';
|
||||
//import Admin from './page.admin.js';
|
||||
|
||||
window.oSpot = new Spot(params);
|
||||
|
||||
//let oProject = new Project(oSpot);
|
||||
//oSpot.addPage('project', oProject);
|
||||
|
||||
@@ -34,6 +31,10 @@ window.oSpot = new Spot(params);
|
||||
import { createApp } from 'vue';
|
||||
import SpotVue from '../Spot.vue';
|
||||
|
||||
const appConfigElement = document.getElementById('app-config');
|
||||
const appConfig = appConfigElement ? JSON.parse(appConfigElement.textContent || '{}') : {};
|
||||
const oSpot = new Spot(appConfig);
|
||||
|
||||
const oSpotVue = createApp(SpotVue);
|
||||
oSpotVue.provide('spot', window.oSpot);
|
||||
oSpotVue.provide('spot', oSpot);
|
||||
oSpotVue.mount('#container');
|
||||
Reference in New Issue
Block a user