js:619 [Vue warn]: Invalid prop: type check failed for prop "status". Expected String with value "function () { [native code] }", got Function found in ---> <ElStep> at packages/step
时间: 2023-10-16 21:18:06 浏览: 40
这个错误发生的原因可能是你在传递 `status` 属性时传递了一个函数,而不是一个字符串类型的值。根据错误信息,你传递的函数代码是 `[native code]`,这说明这个函数是一个原生函数,而不是一个字符串类型的值。
你需要检查一下在哪里传递了 `status` 属性,并且确认传递的值是一个字符串类型的值。如果你需要动态地设置 `status` 属性,可以使用一个计算属性来计算 `status` 的值。
以下是一个示例代码:
```
<template>
<el-steps :active="active" space="100px" align-center>
<el-step title="Step 1" :status="getStatus(1)"></el-step>
<el-step title="Step 2" :status="getStatus(2)"></el-step>
<el-step title="Step 3" :status="getStatus(3)"></el-step>
</el-steps>
</template>
<script>
export default {
data() {
return {
active: 2
}
},
computed: {
getStatus() {
return (step) => {
if (this.active >= step) {
return 'success'
} else {
return 'wait'
}
}
}
}
}
</script>
```
在上面的示例代码中,我们定义了一个计算属性 `getStatus`,它返回一个函数。这个函数接受一个 `step` 参数,通过比较当前的 `active` 值和当前 `step` 值来返回一个字符串类型的值。然后我们在 `el-step` 组件中使用 `:status="getStatus(step)"` 来动态绑定 `status` 属性。
希望这个示例能够帮助你解决问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)