42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
class PageBase {
|
|
constructor(path, vue) {
|
|
this.path = path
|
|
this.name = path.replace(/.*[\\\/]([^\\\/]+)$/g, '$1')
|
|
this.init(vue)
|
|
}
|
|
|
|
init(vue) {
|
|
if (/customNavigation/.test(vue)) {
|
|
this.style = {navigationStyle: "custom"}
|
|
} else {
|
|
this.style = {navigationBarTitleText: this.label}
|
|
//是否开启下拉刷新
|
|
if (/enablePullDownRefresh/.test(vue)) {
|
|
this.style.enablePullDownRefresh = true
|
|
}
|
|
//导航栏标题颜色及状态栏前景颜色,仅支持 black/white
|
|
if (/navigationBarTextStyle/.test(vue)) {
|
|
this.style.navigationBarTextStyle = vue.replace(/[\s\S]*(navigationBarTextStyle:.+),[\s\S]*/gm, '$1')
|
|
}
|
|
//导航栏背景颜色(同状态栏背景色)
|
|
if (/navigationBarBackgroundColor/.test(vue)) {
|
|
this.style.navigationBarBackgroundColor = vue.replace(/[\s\S]*(navigationBarBackgroundColor:.+),[\s\S]*/gm, '$1')
|
|
}
|
|
// //下拉显示出来的窗口的背景色
|
|
// if (/backgroundColor/.test(vue)) {
|
|
// this.style.backgroundColor = vue.replace(/[\s\S]*(backgroundColor:.+),[\s\S]*/gm, '$1')
|
|
// }
|
|
}
|
|
if (/appName/.test(vue)) {
|
|
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1')
|
|
this.label = appName.replace(/(appName:|["'])/g, '')?.trim()
|
|
}
|
|
}
|
|
|
|
setLabel(name) {
|
|
this.label = name
|
|
}
|
|
}
|
|
|
|
module.exports = PageBase
|