Closed yurenlimbu closed 2 years ago
Did you show the code exactly as you have it?
@dima-bzz Yes! My package.json
{
"name": "example",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"test": "jest"
},
"dependencies": {
"autoprefixer": "^9.8.6",
"axios": "^0.21.0",
"core-js": "^3.6.5",
"nuxt": "^2.14.6",
"postcss": "^7.0.35",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.1",
"vuex": "^3.5.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.12.7",
"@nuxtjs/tailwindcss": "^3.2.0",
"@vue/test-utils": "^1.1.0",
"@xiaobu12361/vue-table-export": "^1.0.28",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.5.0",
"babel-loader": "^8.2.1",
"datatables.net-bs4": "^1.10.22",
"datatables.net-buttons-bs4": "^1.6.2",
"datatables.net-responsive": "^2.2.5",
"datatables.net-responsive-bs4": "^2.2.5",
"datatables.net-select-bs4": "^1.3.1",
"jest": "^26.5.0",
"jquery": "^3.5.1",
"vue-csv-downloader": "^1.0.3",
"vue-datatables-net": "^1.2.8",
"vue-good-table": "^2.21.1",
"vue-jest": "^3.0.4",
"vue-template-compiler": "^2.6.12"
}
}
After I remove node_modules and reinstall it. Now I got an error in the browser
vue is undefined
An error occurred while rendering the page. Check developer tools console for details.
And in console error
TypeError: vue is undefined
compileTemplate DataTable.vue:480
mounted DataTable.vue:244
VueJS 11
NuxtJS 4
Babel 18
NuxtJS 2
Babel 12
NuxtJS 11
client.js:96
_callee$ NuxtJS
Babel 8
VueJS 13
NuxtJS 4
Babel 18
NuxtJS 2
Babel 12
NuxtJS 11
In DataTable.vue line no 244
field.render = that.compileTemplate(field, that.$scopedSlots[field.name])
In DataTable.vue line no 480
const res = vue.compile(`<div>${field.template || ''}</div>`)
@yurenlimbu Does everything else work?
@dima-bzz Yes! Only not working as data-table.
@yurenlimbu Try replacing the code from my branch
@dima-bzz as your suggestion I use code from you branch. Now I got this error
$el.DataTable is not a function
An error occurred while rendering the page. Check developer tools console for details.
And in console
TypeError: orders is undefined
created DataTable.vue:316
VueJS 8
client.js:96
creating DatatableTest.vue:172
TypeError: $el.DataTable is not a function
mounted DataTable.vue:418
VueJS 11
NuxtJS 4
Babel 18
NuxtJS 2
Babel 12
NuxtJS 11
@yurenlimbu Did you declare jquery?
@dima-bzz yes!
@yurenlimbu Look at index.html
@yurenlimbu I'm not familiar with nuxt. But I can assume that jquery is not available or the correct sequence for connecting libraries is not correct
Stale issue.
I just copied code as example and setup but not working as expected.
My Datatable component
My App.vue
Browser error
Console Error