小编Rah*_*rma的帖子

使用 jest 测试 vuetify 组件时如何解决“SyntaxError: Unexpected identifier”

I have written many components in vuetify that are reusable. I am using jest testing framework for unit testing. When I run 'npm run test', the test fails with 'SyntaxError: Unexpected identifier'.

All my babel config and jest config are in package.json file. When I create a spec file without any vuetify components, test works. But once I add vuetify, it distorts. I first used localValue from @vue/test-utils to consume vuetify. It didn't work. Then I used Vue.use(Vuetify) and still …

vue.js jestjs babel-jest vuetify.js vue-test-utils

6
推荐指数
1
解决办法
1956
查看次数

从 Angular 6 服务中绑定图像

我有一个端点,它根据某些参数为我提供图像。这不是一个图像网址,而是一个普通图像。因此,当我到达邮递员中的端点时,作为响应,我收到一张图像(JPG)。

我是否可以在变量中接收该图像并将其绑定到 HTML 标签中?

所有问题都有将图像 url 映射到图像的解决方案,而我的是必须在 UI 中显示的图像。

显示图像组件.ts

this.appservice.getImage().subscribe((image) => {
    console.log(image);
 }
)
Run Code Online (Sandbox Code Playgroud)

服务.ts

getImg() {

 return this.httpClient.get('xyz.com', {headers: this.httpHeaders});

 }
Run Code Online (Sandbox Code Playgroud)

我应该如何在 HTML 上显示图像变量中收到的图像?

html javascript angular angular5 angular6

5
推荐指数
1
解决办法
8337
查看次数