:class 在 vue 应用程序中的 testcafe 中出现意外的令牌问题

问题描述

我正在尝试在 Vue 应用程序中运行测试集成 我在 components.test.js 中导入组件,但它给出了一个意外的令牌错误

components.test.js

import flushPromises from "flush-promises";
import {Selector} from "testcafe";
import sample_vue from "../src/components/sample-vue.vue";

enter image description here

有人可以推荐吗?

更新:如果我使用 v-bind:class="" 那么我将面临新的错误

enter image description here

解决方法

我认为你应该添加 v-bind:

v-bind:class="{ error: !nameValidation }"

Nuxt js 支持您刚刚编写的内容。

,

要在 Vue.js 中使用循环,你应该这样做:

<label v-for="(item,i) in option.item" :key="i">{{ item }}</label> // Or whatever you wanna use

它可能不起作用,因为我不知道 typeof option.item 或它包含的内容