设置本机HTML元素的属性

设置本机HTML元素的属性

本文介绍了是否可以在openui5 controller.js中获取/设置本机HTML元素的属性(例如输入)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在openui5控制器中获取输入元素(文件类型)的文件路径值。我可以在xml视图中使用原生html控制器,但很难控制它们。



我尝试过:



成功将原生html元素插入openui5视图。它在选择文件甚至打开相机拍照方面起作用。我现在正在尝试读取js控制器中输入元素选择的文件,但它似乎不起作用。我可以使用var imageInput = this.getView()。byId(imageInputId)获取对象; ...返回XMLView类型的对象,但我无法获取其属性,例如imageInput.files [0]。这是未定义的。

I want to get value of file path of input element (file type) in openui5 controller. I can use native html controller in xml view but struggle with "controlling" them.

What I have tried:

Successfully inserted native html element into openui5 view. It's working in terms of choosing files and even opening camera to take picture. I'm now trying to read file chosen by input element in js controller but it doesn't seem to work. I can fetch object with var imageInput = this.getView().byId("imageInputId"); ... That returns object of type XMLView, but i cannot get its attributes e.g. imageInput.files[0]. That's undefined.

推荐答案

<u:FileUploader

id="fileUploader"

name="myFileUpload"

uploadUrl="upload/"

tooltip="Upload your file to the local server"

uploadComplete="handleUploadComplete"

change="handleValueChange"

...







Controller.extend('FileUploaderComplez.Controller', {
   handleValueChange: function(oEvent){
          //oEvent is fileupload events can have fileContent
   }
}


这篇关于是否可以在openui5 controller.js中获取/设置本机HTML元素的属性(例如输入)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 06:16