Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with calendar and 3.1.1, but not 3.0.2: Property "$primevue" was accessed during render but is not defined on instance #808

Closed
maxant opened this issue Dec 22, 2020 · 3 comments

Comments

@maxant
Copy link

maxant commented Dec 22, 2020

Setup: not quite conventional in that I'm not using a build tool, but rather just importing scripts on my page:

<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
<link href="https://unpkg.com/[email protected]/resources/themes/saga-blue/theme.css" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/resources/primevue.min.css" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/primeicons.css" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/components/calendar/calendar.umd.min.js"></script>
<script src="https://unpkg.com/[email protected]/components/dropdown/dropdown.umd.min.js"></script>
...
<div id="app">
    <p-calendar v-model="model.startDate" :showIcon="true" placeholder="Select a date for your order"></p-calendar>
</div>
....
<script>
const App = {
  data() {
    return {
      model: {"startDate": new Date() }
    }
  },
  components: {
    'p-calendar': calendar
  }
}
Vue.createApp(App).mount("#app")

An error appears after refreshing the page:

[Vue warn]: Property "$primevue" was accessed during render but is not defined on instance. 
  at <PCalendar modelValue= Wed Dec 23 2020 00:03:25 GMT+0100 (Central European Standard Time) 
onUpdate:modelValue=fn<onUpdate:modelValue> showicon=true  ... > 
  at <App>

Clicking on the input field gives me a few similar warnings and then this error:

calendar.umd.min.js:1 Uncaught (in promise) TypeError: Cannot read property 'config' of undefined
at Proxy.sundayIndex (calendar.umd.min.js:1)
at ComputedRefImpl.reactiveEffect [as effect] (vue.global.js:407)
at ComputedRefImpl.get value [as value] (vue.global.js:1191)
at Object.get [as sundayIndex] (vue.global.js:6935)
at Object.get (vue.global.js:7249)
at Proxy.getFirstDayOfMonthIndex (calendar.umd.min.js:1)
at Proxy.months (calendar.umd.min.js:1)
at ComputedRefImpl.reactiveEffect [as effect] (vue.global.js:407)
at ComputedRefImpl.get value [as value] (vue.global.js:1191)
at Object.get [as months] (vue.global.js:6935)

If I revert both vue and primevue back to versions 3.0.2, I no longer have this issue.

@dheimoz
Copy link

dheimoz commented Dec 23, 2020

Please check the breaking changes that the new locale API had introduced:
https://primefaces.org/primevue/showcase/#/locale

@cagataycivici
Copy link
Member

Please see;

#748

Let us know if you still have issued.

@maxant
Copy link
Author

maxant commented Dec 24, 2020

Yes that works now thanks. Updated to:

<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
<link href="https://unpkg.com/[email protected]/resources/themes/saga-blue/theme.css" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/resources/primevue.min.css" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/primeicons.css" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/components/config/primevue.umd.min.js"></script>
<script src="https://unpkg.com/[email protected]/components/calendar/calendar.umd.min.js"></script>
<script src="https://unpkg.com/[email protected]/components/dropdown/dropdown.umd.min.js"></script>

const app = Vue.createApp(App)
app.use(primevue);
app.mount("#app")

Could you please update the docs: https://primefaces.org/primevue/showcase/#/setup
Under "Script Tag" there is no mention of this requirement.
Thanks! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants