4 Star 1 Fork 0

九点鉡/pro-daiyue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.js 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
zouuuuu 提交于 2024-11-07 20:49 . 合并测试
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
// vuex 仓库 store
import store from './store/index.js'
Vue.prototype.$store = store
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App,
store
})
app.$mount()
// #endif
import config from '@/common/config.js'
// api
Vue.prototype.$api = config.appurl;
Vue.prototype.$url = config.cdnurl;
// 图片
const appstc = (url) => {
return config.url + url;
}
// back
const back = (val)=>{
uni.navigateBack(val)
}
// tab
const tab = (index)=>{
let list = [
"/pages/index/index",
"/pages/products/products",
"/pages/store/store",
"/pages/cart/cart",
"/pages/user/user"
]
let url = list[index];
uni.switchTab({
url:url
})
}
// 时间格式化处理
const formatDate = (value) => {
const data = new Date(value);
const month = data.getMonth() + 1;
const day = data.getDate();
const year = data.getFullYear();
const hours = data.getHours();
const minutes = data.getMinutes();
const seconds = data.getSeconds();
const formattedTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
return formattedTime;
}
// 处理热卖多少件
const hotbuyShow = (value) => {
if (value >= 10000) {
let val = value / 10000
// console.log(app.$t)
return ` ${val} 万+ `
} else if (value >= 1000) {
let val = value / 1000
return ` ${val} 千+ `
} else {
return value
}
}
const isnum = 1
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
Vue.prototype.$daiyueapp = {
appstc,
formatDate,
back,
hotbuyShow,
isnum,
tab,
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/JIU-DIAN-BAN/pro-daiyue.git
[email protected]:JIU-DIAN-BAN/pro-daiyue.git
JIU-DIAN-BAN
pro-daiyue
pro-daiyue
master

搜索帮助