praella-agency / polaris-vue

Polaris Vue by HulkApps is a component library for Vue.js based on Shopify Polaris style guide.
https://polaris-vue.hulkapps.com
MIT License
37 stars 10 forks source link

[Bug] PSelect components, if the "valueField" and "textField" parameters are not passed in, an exception will be displayed #63

Closed PrintNow closed 3 years ago

PrintNow commented 3 years ago

This code comes from your document, using this code "PSelect component" can not achieve the expected effect

https://polaris-vue.hulkapps.com/?path=/docs/forms-select--select

<template>
<div>
<PSelect
:disabled="false"
label="Sort byddd"
:options='[{"label":"Newest update","value":"newestUpdate"},{"label":"Oldest update","value":"oldestUpdate"},{"label":"Most spent","value":"mostSpent"},{"label":"Most orders","value":"mostOrders","disabled":true},{"label":"Last name A–Z","value":"lastNameAlpha","hidden":true},{"label":"Last name Z–A","value":"lastNameReverseAlpha"}]'
disabledField=""
:value="null"
placeholder="Select"
/>
<br />
</div>
</template>

image


I thought it was my environmental problem, until I read the source code:/src/components/PSelect/PSelect.vue#L93

It seems that the default value is not working

image

When I manually pass in these parameters, it is work:

<template>
  <div>
    <PSelect
      :disabled="false"
      label="Sort byddd"
      :options='[{"label":"Newest update","value":"newestUpdate"},{"label":"Oldest update","value":"oldestUpdate"},{"label":"Most spent","value":"mostSpent"},{"label":"Most orders","value":"mostOrders","disabled":true},{"label":"Last name A–Z","value":"lastNameAlpha","hidden":true},{"label":"Last name Z–A","value":"lastNameReverseAlpha"}]'
      disabledField=""
      value-field="label"
      text-field="value"
      :value="null"
      placeholder="Select"
    />
    <br />
  </div>
</template>

image

uttam-praella commented 3 years ago

@PrintNow
Thank you for reporting the bug here, could you please specify which version you are currently using? This issue was raised in 2.3.2 release and we have fixed it on 2.3.3.

Thanks

PrintNow commented 3 years ago

@uttam-hulkapps Sorry, I am using version 2.3.2, I will update now

uttam-praella commented 3 years ago

@PrintNow

Thank you for confirmation, closing it.