<template> <view class='commodity-List'> <Commodity :dataList:'commodityList'></Commodity> </view> </template> <script> import Commodity from './Commodity.vue' export default { data() { return { commodityList: [{ id: 1, imgUrl: "../../static/img/格子衫.webp", name: "便宜大衣快来买啦,不买后悔呀!为了不后悔,一定要买呀!!!", pprice: "299", oprice: "466", discount: "5.6折" }, { id: 2, imgUrl: "../../static/img/短袖.jpg", name: "便宜大衣快来买啦,不买后悔呀!为了不后悔,一定要买呀!!!", pprice: "299", oprice: "466", discount: "5.6折" }] } },,uniapp报错
时间: 2023-07-21 20:07:15 浏览: 164
根据你提供的代码,有一个明显的错误。在 `<Commodity>` 组件中,使用 `:` 绑定属性时,应该使用单个冒号而不是双冒号。另外,在 `export default` 的对象中,有一个额外的逗号,需要将其删除。下面是修正后的代码:
```vue
<template>
<view class="commodity-List">
<Commodity :dataList="commodityList"></Commodity>
</view>
</template>
<script>
import Commodity from './Commodity.vue'
export default {
data() {
return {
commodityList: [
{
id: 1,
imgUrl: "../../static/img/格子衫.webp",
name: "便宜大衣快来买啦,不买后悔呀!为了不后悔,一定要买呀!!!",
pprice: "299",
oprice: "466",
discount: "5.6折"
},
{
id: 2,
imgUrl: "../../static/img/短袖.jpg",
name: "便宜大衣快来买啦,不买后悔呀!为了不后悔,一定要买呀!!!",
pprice: "299",
oprice: "466",
discount: "5.6折"
}
]
}
},
components: {
Commodity
}
}
</script>
```
请注意,我假设你的文件路径和引入组件的方式是正确的。如果还有其他问题,请提供更多细节。
阅读全文