我有一个nativescript-vue项目,我想集成ag-grid。我使用this作为指导,但是当我导航到网格所在的页面时,会得到以下信息:
CONSOLE LOG file:///app/vendor.js:59600:14: \134^[[32m'{NSVue (Vue: 2.5.17 | NSVue: 2.0.2)} -> AppendChild(ElementNode(nativestacklayout), ElementNode(nativeabsolutelayout))'\134^[[39m
CONSOLE ERROR file:///app/vendor.js:53456:20: [Vue warn]: Unknown custom element: <div> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <AgGridVue>
<Page>
<Home> at components/Home/Home.vue
<NavigationEntry>
CONSOLE LOG file:///app/vendor.js:59600:14: \134^[[32m'{NSVue (Vue: 2.5.17 | NSVue: 2.0.2)} -> CreateElement(div)'\134^[[39m
我通过以下方式安装:
npm install-保存ag-grid-community ag-grid-vue vue-property-decorator
这是我的设置:
app.js
import Vue from "nativescript-vue";
...
const vn = new Vue({
render: h => h('frame', [h(routes.home)])
}).$start();
Home.vue (从另一个vue页面路由)
<template>
<Page class="page">
<ActionBar title="home" class="action-bar" icon="" />
<ScrollView>
<StackLayout flexDirection="column" justifyContent="center" class="full-height">
<Label textWrap="true" text="My Home"/>
<ag-grid-vue style="width: 400px; height: 400px;"
class="ag-theme-balham" :columnDefs="columnDefs"
:rowData="rowData">
</ag-grid-vue>
</ScrollView>
</Page>
</template>
<script>
import { AgGridVue } from "ag-grid-vue";
export default {
props:['userId'],
data() {
return {
textFieldValue: "",
columnDefs: null,
rowData: null
};
},
components: {
AgGridVue,
},
beforeMount() {
this.columnDefs = [{
headerName: "Make",
field: "make"
},
{
headerName: "Model",
field: "model"
},
{
headerName: "Price",
field: "price"
}
];
this.rowData = [{
make: "Toyota",
model: "Celica",
price: 35000
},
{
make: "Ford",
model: "Mondeo",
price: 32000
},
{
make: "Porsche",
model: "Boxter",
price: 72000
}
];
},
methods:{
...
}
</script>
<style lang="scss">
@import "../../../node_modules/ag-grid-community/dist/styles/ag-grid.css";
@import "../../../node_modules/ag-grid-community/dist/styles/ag-theme-balham.css";
</style>