flat: 添加config项目配置文件
This commit is contained in:
16
App.vue
16
App.vue
@@ -37,6 +37,9 @@
|
||||
return this.news.allUnread
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$config.showTitle && document.documentElement.style.setProperty('--hide-title', 'block');
|
||||
},
|
||||
watch: {
|
||||
allUnread(value) {
|
||||
if (!this.$store.state.user.token) {} else if (value > 0) {
|
||||
@@ -63,7 +66,7 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss">
|
||||
/*每个页面公共css */
|
||||
/* tabbar 字体大小 */
|
||||
/* .uni-tabbar__label{
|
||||
@@ -75,4 +78,15 @@
|
||||
font-style: mormal;
|
||||
src: url('/static/font/font_2225171_8kdcwk4po24.ttf') format('truetype');
|
||||
}
|
||||
|
||||
:root {
|
||||
--hide-title: none;
|
||||
}
|
||||
|
||||
/* #ifdef H5 */
|
||||
uni-page-head {
|
||||
display: var(--hide-title);
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
</style>
|
||||
28
config.js
Normal file
28
config.js
Normal file
@@ -0,0 +1,28 @@
|
||||
module.exports = {
|
||||
baseUrl: '',
|
||||
// 图片地址
|
||||
imageUrl: '',
|
||||
// 显示标题
|
||||
showTitle: false,
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
name: "",
|
||||
// 应用版本
|
||||
version: "1.0.0",
|
||||
// 应用logo
|
||||
logo: "",
|
||||
// 官方网站
|
||||
site_url: "",
|
||||
// 政策协议
|
||||
agreements: [{
|
||||
title: "隐私政策",
|
||||
url: ""
|
||||
},
|
||||
{
|
||||
title: "用户服务协议",
|
||||
url: ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
26
main.js
26
main.js
@@ -3,6 +3,7 @@ import store from './store';
|
||||
import App from './App'
|
||||
import util from './untils/func.js'
|
||||
import uView from '@/uni_modules/uview-ui'
|
||||
import config from './config';
|
||||
|
||||
// 注册全局组件
|
||||
// import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
|
||||
@@ -11,9 +12,10 @@ import uView from '@/uni_modules/uview-ui'
|
||||
// Vue.component('mescroll-uni', MescrollUni)
|
||||
|
||||
import empty from '@/components/empty/empty.vue'
|
||||
|
||||
function navTo(url, needLogin) {
|
||||
console.log(url)
|
||||
if(needLogin) {
|
||||
if (needLogin) {
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
@@ -21,13 +23,13 @@ function navTo(url, needLogin) {
|
||||
})
|
||||
}
|
||||
|
||||
const msg = (title, duration=1500, mask=false, icon='none')=>{
|
||||
uni.showToast({
|
||||
title,
|
||||
duration,
|
||||
mask,
|
||||
icon
|
||||
});
|
||||
const msg = (title, duration = 1500, mask = false, icon = 'none') => {
|
||||
uni.showToast({
|
||||
title,
|
||||
duration,
|
||||
mask,
|
||||
icon
|
||||
});
|
||||
}
|
||||
|
||||
// 注册全局组件
|
||||
@@ -41,7 +43,10 @@ Vue.component('jl-form-item', JlFormItem)
|
||||
Vue.component('cs-button', CSButton)
|
||||
Vue.component('empty', empty)
|
||||
|
||||
Vue.prototype.$api = { msg }
|
||||
Vue.prototype.$api = {
|
||||
msg
|
||||
}
|
||||
Vue.prototype.$config = config
|
||||
Vue.prototype.navTo = navTo
|
||||
Vue.config.productionTip = false
|
||||
|
||||
@@ -50,6 +55,7 @@ Vue.use(uView)
|
||||
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
...App,store
|
||||
...App,
|
||||
store
|
||||
})
|
||||
app.$mount()
|
||||
Reference in New Issue
Block a user