小编Sim*_*mon的帖子

错误 [ERR_PACKAGE_PATH_NOT_EXPORTED]:在 /app/node_modules/@babel/helper-compilation-targets/package.json 中没有解决“导出”主要问题

我在 travis CI 管道中构建我的 nuxt 图像时遇到问题。我的本地环境是 ubuntu 18.04 - docker version 19.03.11 docker-compose version 1.24.1 我能够在本地构建和运行我的图像,但是在 travis CI 上我收到以下错误

Step 5/7 : RUN npm run build
 ---> Running in d3e9433b79f0
> nuxt_app@1.0.0 build /app
> nuxt build
? Production build
? Builder initialized
? Nuxt files generated
? Compiling Client
? Starting type checking service...
? Using 1 worker with 2048MB memory limit
? Client: Compiled with some errors in 1.62s
Hash: 1b9cf81215d31b9f0ed3
Version: webpack 4.43.0
Time: 1624ms
Built at: …
Run Code Online (Sandbox Code Playgroud)

node.js travis-ci docker nuxt.js

26
推荐指数
6
解决办法
3万
查看次数

如何自定义 Firebase DocumentData 接口?

我正在使用 firebase@5.5.8 和 typescript@3.1.4

每当我从 firestore 创建文档时,我都会firebase.firestore.DocumentReference按预期得到一个类型的对象

如果我打电话给get(options?: firebase.firestore.GetOptions|undefined)我会firebase.firestore.DocumentSnapshot按预期得到一个类型的对象

如果我打电话,data(options?: firebase.firestore.DataOptions|undefined)我会得到一个 firebase.firestore.DocumentData 对象或未定义,正如预期的那样

现在,在我的管理器对象上,我知道我要写入数据库的内容,因此我可以断言,无论您从我的管理器中获得什么 DocumentData,您都将获得一个客户端,如图所示

export interface Client {
    name: string;
    website?: string;
    description?: string;
    visible: boolean;
}
Run Code Online (Sandbox Code Playgroud)

我想为我的管理器对象创建一个接口来表达这一点。所以我试过:

export interface FirebaseDocumentSnapshot<T> extends $firebase.firestore.DocumentSnapshot {
    data(options?: $firebase.firestore.SnapshotOptions | undefined): T|undefined
}

export interface FirebaseDocumentReference<T> extends $firebase.firestore.DocumentReference {
    get(options?: $firebase.firestore.GetOptions | undefined): Promise<FirebaseDocumentSnapshot<T>>
}
Run Code Online (Sandbox Code Playgroud)

我遇到的问题在这里:

const client: Client = mapClient(args);

const result: FirebaseDocumentReference<Client> = await $db.add(client);
Run Code Online (Sandbox Code Playgroud)

错误是:

[ts]

Type 'DocumentReference' is not assignable …
Run Code Online (Sandbox Code Playgroud)

node.js firebase typescript google-cloud-firestore

9
推荐指数
2
解决办法
5510
查看次数

Vuetify v0.17.6:如何在v-select中获取自动完成文本

我正在使用VueJS v2.5.13和Vuetify v0.17.6。

我正在构建具有自动完成功能的选择,并且只要用户键入列表中未列出的内容,他们就可以看到创建新选项的操作,如下代码所示:

<template>
<v-select prepend-icon="view_list" :items="options" label="Quick searches" v-model="selected" item-text="label" autocomplete :search-value="inputText" clearable dense>
    <template slot="item" slot-scope="data">
        <v-flex xs12>
            <v-layout>
                <v-layout justify-start fill-height align-content-center>
                    <span>{{data.item.label}}</span>
                </v-layout>
                <v-layout justify-end row>
                    <v-icon color="success" @click="edit(data)">mod_edit</v-icon>
                    <v-icon color="error" @click="del(data)">delete_forever</v-icon>
                </v-layout>
            </v-layout>
        </v-flex>
    </template>
    <template slot="no-data">
        <v-container>
            <v-layout row>
                <v-layout justify-start fill-height align-content-center>
                    Create new search
                </v-layout>
                <v-layout justify-end>
                    <v-icon color="success" @click="create()">add</v-icon>
                </v-layout>
            </v-layout>
        </v-container>
    </template>
</v-select>
Run Code Online (Sandbox Code Playgroud)

如何使用用户自动填充的文本作为标签来访问用户键入的文本以创建新的“快速搜索”?

javascript vuejs2 vuetify.js

3
推荐指数
1
解决办法
8635
查看次数