nativescript-community / ui-material-components

Monorepo that contains all of the NativeScript Material Design plugins.
https://nativescript-community.github.io/ui-material-components/
Apache License 2.0
216 stars 80 forks source link

does not work with vue3 #428

Open u007 opened 1 year ago

u007 commented 1 year ago

Make sure to check the demo app(s) for sample usage

generic starter template with material text field

If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital letter.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:


### Please, tell us how to recreate the issue in as much detail as possible. 
Describe the steps to reproduce it.

create a vue3 native project from base template.

in app.ts```
import { createApp } from 'nativescript-vue';
import Home from './components/Home.vue';
import TextFieldPlugin from '@nativescript-community/ui-material-textfield/vue';

const app = createApp(Home)
app.use(TextFieldPlugin);

app.start();

inside the page component```

vallemar commented 1 year ago

For vue3 you need register component in your main.ts or app.ts:

import {createApp, registerElement} from 'nativescript-vue';

registerElement('MDTextField', () => require("@nativescript-community/ui-material-textfield").TextField, {
    model: {
        prop: 'text',
        event: 'textChange'
    }
})
u007 commented 1 year ago

hey bro, thank you, let me try 😄

u007 commented 1 year ago

just realised i tried this long ago and didnt work, got this:

  [$navigateTo] Failed to navigate:
  {} TypeError: Cannot set property android of [object Object] which has only a getter
  at setValue (file: src/webpack:/movingapp/node_modules/set-value/index.js:154:0)
  at NSVElement.setAttribute (file: src/webpack:/movingapp/node_modules/nativescript-vue/dist/dom/index.js:120:16)
  at patchAttr (file: src/webpack:/movingapp/node_modules/nativescript-vue/dist/renderer/modules/attrs.js:28:0)
  at patchProp (file: src/webpack:/movingapp/node_modules/nativescript-vue/dist/renderer/patchProp.js:26:25)
  at mountElement (file: src/webpack:/movingapp/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5204:0)
  at processElement (file: src/webpack:/movingapp/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5178:0)
  at patch (file: src/webpack:/movingapp/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5098:0)
  at mountChildren (file: src/webpack:/movingapp/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5285:0)
  at mountElement (file: src/webpack:/movingapp/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5195:0)
  at processElement (file: src/webpack:/movingapp/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5178:0)
  [Vue warn]: Unhandled error during execution of component event handler
  at <Button1 onTap=fn width="100%" horizontalAlignment="center"  ... >
  at <BottomBar dock="bottom" class="" >
  at <Home>