Skip to content

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

Open
nokhnaton wants to merge 7 commits into
traPtitech:mainfrom
nokhnaton:bar-code
Open

バーコードモーダルの選択/ボタンでcomponents/UIを利用する#993
nokhnaton wants to merge 7 commits into
traPtitech:mainfrom
nokhnaton:bar-code

Conversation

@nokhnaton

Copy link
Copy Markdown
Contributor

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

Comment thread src/components/RegisterForm/BarCodeScanner.vue Outdated
@nokhnaton

Copy link
Copy Markdown
Contributor Author

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

@ryoha000

Copy link
Copy Markdown
Member

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

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

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

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

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

Comment thread src/components/RegisterForm/BarCodeScanner.vue Outdated
Comment thread src/components/RegisterForm/BarCodeScanner.vue Outdated
Comment thread src/components/RegisterForm/BarCodeScanner.vue Outdated
Comment thread src/components/RegisterForm/RegisterFormDescription.vue Outdated
Comment thread src/components/RegisterForm/BarCodeScanner.vue Outdated
@nokhnaton

Copy link
Copy Markdown
Contributor Author

直しました!

@ryoha000 ryoha000 marked this pull request as ready for review May 19, 2022 19:22
const toastStore = useToast()

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

Copy link
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

残しといてほしいです

const inputs = ref<VideoInputDevice[]>([])
const selectInput = ref<VideoInputDevice>()
const videoEle = shallowRef<HTMLVideoElement>()
const deviceOptions = ref<DeviceOption[]>([])

Copy link
Copy Markdown
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