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

バーコードモーダルの選択/ボタンでcomponents/UIを利用する #993

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

nokhnaton
Copy link
Contributor

セレクターの初期値を設定する部分がどうもうまくできてないようで、何も表示されません。他は見た目はちゃんと動いてると思います。

@nokhnaton
Copy link
Contributor Author

v-modelってstringしか受け付けないってことでいいのでしょうか?ItemsPageのSortTypeも基本はstringで特定の値だけしか受け付けないように設定してあるものって認識で大丈夫でしょうか?

@ryoha000
Copy link
Member

昨日はやる気が出なかったので返信できませんでした。ごめんなさい

v-modelってstringしか受け付けない

これは違くて受け取るコンポーネントのpropsmodelValueという値の型次第です
ASelectorだと

const props = defineProps<{
  label?: string
  options: readonly Option[]
  modelValue: string
}>()

部分ですね
多分何でもいいですがstringnumber以外はあんまり見ない気がします

src/components/RegisterForm/BarCodeScanner.vue Outdated Show resolved Hide resolved
src/components/RegisterForm/BarCodeScanner.vue Outdated Show resolved Hide resolved
src/components/RegisterForm/BarCodeScanner.vue Outdated Show resolved Hide resolved
src/components/RegisterForm/RegisterFormDescription.vue Outdated Show resolved Hide resolved
src/components/RegisterForm/BarCodeScanner.vue Outdated Show resolved Hide resolved
@nokhnaton
Copy link
Contributor Author

直しました!

@ryoha000 ryoha000 marked this pull request as ready for review May 19, 2022 19:22
@@ -26,16 +23,25 @@ const emit = defineEmits<{
const toastStore = useToast()

const codeReader = new BrowserBarcodeReader()
const inputs = ref<VideoInputDevice[]>([])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

残してほしいです


const initialize = async () => {
try {
const videoInputDevices = await codeReader.getVideoInputDevices()
inputs.value = videoInputDevices
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

残しといてほしいです

const videoEle = shallowRef<HTMLVideoElement>()
const deviceOptions = ref<DeviceOption[]>([])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const deviceOptions = ref<DeviceOption[]>([])
const deviceOptions = computed<DeviceOption[]>(() => inputs.map(v => ({
key: v?.deviceId ?? '',
label: v?.label ?? 'no device name'
})))

かな?
computedを使うと更新のし忘れがなくなるからこうしたいです
現状VideoInputDevice[]initializeでしか更新されてませんが今後ほかのところで更新することになるかもしれないので

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

Successfully merging this pull request may close these issues.

2 participants