我想根据本地设置来初始化设备,然后将设备保存到store内
device[key]是每个设备的类
let configDevices = this.config.devices
let devices = {}
Object.keys(configDevices).forEach(key => {
devices[key] = new device[key](configDevices[key].name, configDevices[key].params)
})
this.$store.dispatch('updateDevices', devices)
这样在其它组件内就能通过
data = await this.devices.SNDP.getStatus()
直接使用设备了
但是,通过store中转一下,就没有类型推断了
请问,有什么方法能强制指定store获取的数据的类型吗
add我q3461896724详细说