1,创建 object 标签
if (!document.getElementById('ocxTest')) {
let obj = document.createElement('OBJECT')
obj.setAttribute('id', 'ocxTest')
obj.setAttribute('classid', 'clsid:(id)') // class ID
obj.setAttribute('width', 0)
obj.setAttribute('height', 0)
this.$refs.outer.appendChild(obj)
}
id : class ID
2,发送报文,获取结果
let ocx = document.getElementById('ocxTest');
try {
let str = '(后端返回的报文)'
let ret = ocx.yhcsCmd(str);
console.log(`ret: ${ret}`);
} catch (e) {
console.log(`错误: ${e}`);
}
yhcsCmd() ie浏览器方法 不支持其他浏览器
3,ie浏览器设置
打开ie浏览器设置 允许全部ActiveX控件和插件