子组件:
```bash
<template>
<div>
<a-table :columns="columns" :data-source="data1"></a-table>
</div>
</template>
<script>
import { defineComponent } from 'vue'
export default defineComponent({
props:{
data1: Array,
columns: Array
},
setup(props,context){
const p = toRefs(props);
const data1 = p.data1;
const columns = p.columns;
console.log(data1)
return{
data1,
columns
}
}
})
</script>
父组件:
```bash
<template>
<stable :data1="data" :columns="columns"></stable>
</template>
<script>
import { reactive, onMounted } from 'vue'
import { stable } from '@/components/Table/index.vue'
import { getList } from '@/api/news'
export default {
components: { stable },
setup() {
let data = reactive([])
let columns = reactive([
{
dataIndex: 'title',
key: 'title',
slots: {
title: '标题',
customRender: 'title',
},
},
{
title: '发布人',
dataIndex: 'fbr',
key: 'fbr',
},
{
title: '关键字',
dataIndex: 'keywords',
key: 'keywords',
},
{
title: '来源',
key: 'source',
dataIndex: 'source',
slots: {
customRender: 'source',
},
},
{
title: 'Action',
slots: {
customRender: 'action',
},
},
])
onMounted(
getList().then(res=>{
debugger
if(res && res.code === 10000){
data = res.data.rows
}
})
)
return {
data,
columns
}
},
}
</script>
报错:The requested module '/src/components/Table/index.vue?t=1665730501281' does not provide an export named 'stable' (at index.vue:7:10)