导出代码:
// letterbox.ts
const db = wx.cloud.database()
export interface LetterboxInfo {
title: string;
company?: string;
description?: string;
isanonymous: boolean;
isrepeat: boolean;
endtime?: string;
status: string;
posterPath?: string;
}
export class LetterboxClass{
letterbox: LetterboxInfo;
constructor (letterbox: LetterboxInfo) {
this.letterbox = letterbox;
}
// 新增
add () {
return db.collection('letterbox').add({
data: {
}
})
}
}
导入代码:
// index.ts
import { LetterboxClass, LetterboxInfo } from '../../../apis/letterbox'
Page({
data: {
},
letterboxCreate() {
let letterboxInfo: LetterboxInfo = {
title: '在客户端创建的意见箱',
description: '这是在客户端创建的意见箱,使用ts+sass技术创建的项目',
isanonymous: false,
status: '0',
isrepeat: false
}
let lb = new LetterboxClass(letterboxInfo)
lb.add()
console.log(lb)
}
})
报错:
各位大神请指教。