This commit is contained in:
yanran200730
2022-11-04 17:45:54 +08:00
2 changed files with 41 additions and 21 deletions

View File

@@ -0,0 +1,37 @@
class PageBase {
constructor(path, vue) {
this.path = path
this.name = path.replace(/.*\\([^\\]+).vue/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()
}
}
}
module.exports = PageBase