|
@@ -10,8 +10,17 @@ import {getPlatform, loadJS} from './module/utils'
|
|
|
|
|
|
class EasyUse {
|
|
|
constructor(options = {}) {
|
|
|
+
|
|
|
+ // 默认配置文件、版本号读取
|
|
|
+ const dataSoucre = `/common-module/track/json/${getPlatform() === 'PC' ? 'pc' : 'mobile'}.json`
|
|
|
+ let version = ''
|
|
|
+ if (window.goTemplateData && window.goTemplateData.version) {
|
|
|
+ version = window.goTemplateData.version
|
|
|
+ }
|
|
|
+
|
|
|
this.config = Object.assign({
|
|
|
- dataSource: '/common-module/track/json/pc.json'
|
|
|
+ dataSoucre,
|
|
|
+ version
|
|
|
}, options)
|
|
|
this.json = []
|
|
|
this.params = {}
|
|
@@ -179,7 +188,7 @@ class EasyUse {
|
|
|
* 获取页面数据集
|
|
|
*/
|
|
|
getDataJSON() {
|
|
|
- this.getJSON(this.config.dataSource, (data) => {
|
|
|
+ this.getJSON(`${this.config.dataSource}${this.config.version ? ('?v=' + this.config.version) : ''}`, (data) => {
|
|
|
if (Array.isArray(data)) {
|
|
|
this.json = [].concat(data)
|
|
|
this.upPageInfo()
|