65 lines
2.0 KiB
JavaScript
65 lines
2.0 KiB
JavaScript
// app.js
|
|
import {
|
|
appUrl,
|
|
imgAssets
|
|
} from './net/http'
|
|
App({
|
|
globalData: {
|
|
imgAssetsUrl: imgAssets,
|
|
localAssets: "/static/images",
|
|
slideBtns: [],
|
|
appTitle: 'AI喵著',
|
|
appUrl: appUrl,
|
|
onlyDelBtns: [],
|
|
cancelEditBtns: []
|
|
},
|
|
onLaunch() {
|
|
this.globalData.cancelEditBtns = [{
|
|
text: '撤销',
|
|
src: this.globalData.localAssets + "/ic_cancel_yellow.png" // icon的路径
|
|
}]
|
|
this.globalData.onlyDelBtns = [{
|
|
text: '删除',
|
|
src: this.globalData.localAssets + "/ic_delete_red.png" // icon的路径
|
|
}]
|
|
this.globalData.slideBtns = [{
|
|
text: '编辑',
|
|
src: this.globalData.localAssets + "/ic_edit_blue.png" // icon的路径
|
|
},
|
|
{
|
|
text: '删除',
|
|
src: this.globalData.localAssets + "/ic_delete_red.png" // icon的路径
|
|
}
|
|
]
|
|
//自定义字体
|
|
// wx.loadFontFace({
|
|
// family: 'PingFang-regular',
|
|
// global: true,
|
|
// source: 'https://www.aimzhu.com/miniapp-assets/PingFangSC-Regular.ttf',
|
|
// success(res) {
|
|
// console.log('字体加载成功')
|
|
// },
|
|
// fail(err) {
|
|
// console.log('字体加载错误')
|
|
// }
|
|
// })
|
|
// 全局事件对象
|
|
// this.eventBus = {}
|
|
// // 监听事件
|
|
// this.on = function (eventName, callback) {
|
|
// if (!this.eventBus[eventName]) {
|
|
// this.eventBus[eventName] = []
|
|
// }
|
|
// this.eventBus[eventName].push(callback)
|
|
// }
|
|
// // 触发事件
|
|
// this.emit = function (eventName, data) {
|
|
// const callbacks = this.eventBus[eventName]
|
|
// if (callbacks) {
|
|
// callbacks.forEach(callback => {
|
|
// callback(data)
|
|
// })
|
|
// }
|
|
// }
|
|
}
|
|
}) |