我已将import urllib.request
import datatime
import time
from django.utils import translation
def isset(variable):
return variable in locals() or variable in globals()
def waprfile(request, date):
if(not isset(date) or date==False):
date = datetime.datetime.now().strftime('%d.%m.%Y')
timestmp = time.mktime(datatime.datetime.strptime(date, "%d.%m.%Y").timetuple())
filepath = "https://www.example.com/files/" + str(translation.get_language()) + "/"
formatted_date = datetime.datetime.fromtimestamp(timestmp).strftime('%d%m%y')
if(urllib.request.urlopen(filepath + formatted_date + '.xls')):
# What must be here?
else:
# What must be here?
response = HttpResponse(content_type='application/ms-excel')
response['Content-Disposition'] = 'attachment; filename=' + fileName
return response
和paths
添加到我的baseUrl
tsconfig.json
我是新手稿的新手,我真的看了一下,但无法解决我的问题。
我试图:
{
"compilerOptions": {
"outDir": "./built/",
"sourceMap": true,
"baseUrl": ".",
"paths": {
"*": [ "./typings/*" ]
},
"strict": true,
"noImplicitReturns": true,
"module": "es2015",
"moduleResolution": "node",
"target": "es5"
},
"include": [
"./src/**/*"
]
}
我一直收到错误:
--index.ts
import * as VueGoogleMaps from "vue2-google-maps"
Vue.use(VueGoogleMaps, {
load: {
key: GMAPS_KEY,
libraries: 'places',
}
}
我尝试了一堆TS2345: Argument of type 'typeof 'vue2-google-maps'' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
但是我错过了基础知识,我知道./typings/index.d.ts
应该有一种PluginObject,但我不知道声明它的语法。
我试过了:
VueGoogleMaps
感谢任何帮助