Commit 8c92d3d8 by 张立顺

配置页面和组件导入IMG_URL

1 parent ae8ee0d6
// components/Tab/Tab.js
// behaviors: [LocationBehavior],
import { imgUrlMixin } from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
/**
* 组件的属性列表
*/
......
import { IMG_URL } from '~/utils/constantData'
module.exports = Behavior({
data: {
IMGURL: IMG_URL
}
})
import imgUrlMixin from './imgUrl'
module.exports = {
}
\ No newline at end of file
imgUrlMixin
}
......@@ -7,6 +7,7 @@ Page({
*/
data: {
navStyle,
// IMG_URL
},
/**
......
import { IMG_URL } from '~/utils/constantData'
/**
* 执行路由前的准备工作
*/
/**处理前置钩子逻辑 */
const routerBefore = (next) => {
const routerBefore = next => {
// console.log("处理前置钩子逻辑");
next();
};
let page = wx.$router.getPageInstance()
page && (page.data.IMG_URL = IMG_URL)
// page && page.setData({ IMG_URL })
// console.log()
// console.log(next)
next()
}
/**处理后置钩子逻辑 */
const routerAfter = (next) => {
const routerAfter = next => {
// console.log("处理后置钩子逻辑");
next();
};
next()
}
// 重写Page方法
const OldPage = Page;
const OldPage = Page
Page = function (options) {
const oldShow = options.onShow;
const oldHide = options.onHide;
const oldShow = options.onShow
const oldHide = options.onHide
options.onShow = function () {
routerBefore(() => {
oldShow.apply(this, arguments);
});
};
oldShow.apply(this, arguments)
})
}
options.onHide = function () {
routerAfter(() => {
oldHide.apply(this, arguments);
});
};
OldPage(options);
};
oldHide.apply(this, arguments)
})
}
OldPage(options)
}
export default routerBefore;
\ No newline at end of file
export default routerBefore
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram-test/cgacar/'
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/'
// 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!