nativescript-markdown-view icon indicating copy to clipboard operation
nativescript-markdown-view copied to clipboard

How to use with nativescript-vue ?

Open Astriaporta opened this issue 5 years ago • 2 comments

Is there an example of use with nativescript-view? I tried to import it into a component as an element but it doesn't work.

Astriaporta avatar Oct 21 '20 08:10 Astriaporta

yes you have to register the Plugin in the vue environment. Here is a example how I use it

Vue.registerElement( 'MdView', () => require('nativescript-markdown-view').MarkdownView )

kaisten avatar Feb 01 '21 08:02 kaisten

Vue.registerElement('MdView', () => new MarkdownView()) Same error message with kaisten's method

 {NSVue (Vue: 2.6.14 | NSVue: 2.9.2)} -> CreateElement(mdview)
  JS: TypeError: Could not load view for: nativemdview. TypeError: Class constructor TextView cannot be invoked without 'new' TypeError: Class constructor TextView cannot be invoked without 'new'
  JS:     at MarkdownViewBase [as constructor] (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-markdown-view/markdown-view.common.js:8:0)
  JS:     at new MarkdownView (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-markdown-view/markdown-view.android.js:9:0)
  JS:     at Object.resolver (file: app/webpack:/cnick-app/app/app.ts:24:30)
  JS:     at getViewClass (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-vue/dist/index.js:7603:0)
  JS:     at new ElementNode (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-vue/dist/index.js:8466:0)
  JS:     at Function.createElement (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-vue/dist/index.js:8578:0)
  JS:     at Object.createElement (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-vue/dist/index.js:8607:0)
  JS:     at createElm (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-vue/dist/index.js:5297:0)
  JS:     at createChildren (file: app/webpack:/cnick-app/node_modules/.pnpm/[email protected]/node_modules/nativescript-vue/dist/index.js:5401:0)
  JS:     at createElm (file:///data/dat...
  JS: [Navigator] Failed to navigate: TypeError: Cannot read property 'setAttribute' of undefined

I always get TypeError: Class constructor TextView cannot be invoked without 'new'

PixsaOJ avatar Jul 06 '23 04:07 PixsaOJ