lefreet / vue-form Goto Github PK
View Code? Open in Web Editor NEWa vue form component with some form controls base on Element-UI.
a vue form component with some form controls base on Element-UI.
Hi,起因是发现一个兼容性bug,field-tree在edge里面,弹出来的tree很窄,然后看了一下代码。。
field-tree的mounted里面的代码有问题呀!~
// 保持弹框宽度和输入框一致 let $input = this.$refs['input'].$el let observer = new MutationObserver((mutations, observer) => { this.popWidth = $input.getBoundingClientRect().width - 24 observer.disconnect() }) observer.observe($input, { attributes: true, subtree: false, characterData: false, childList: false }) this.setShowValue() this.getData()
这段代码按注释来看,应该是想监听input的width,然后动态改变tree的width,因为没有这种监听事件,所以用了MutationObserver来监听attribute改变,而且还只是一次性的(很奇怪),但这个是有问题的。。
因为input的width是设置为100%的,按理来说是不会触发observer的,我实际跟踪下来,发现在chrome里面会触发(虽然触发,但是没有任何新旧修改数据),edge里面不会触发。
总之,很奇怪,反正是达不到监听input的宽度动态改变tree宽度的,感觉如果要监听,只能监听window的resize事件了
但这个没有必要,至少目前对于我来说是的,所以我直接设置popWidth了:
let $input = this.$refs['input'].$el this.popWidth = $input.getBoundingClientRect().width - 24 this.setShowValue() this.getData()
demo里的完整示例中的下拉框没有显示出来,本地安装后也没有显示,
在浏览器中测试了下移动界面,发现排版有点凌乱
ERROR in ./node_modules/@lefreet/vue-form/src/components/field-tree.vue 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
|
|
ERROR in ./node_modules/@lefreet/vue-form/src/components/field-checkbox.vue 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
|
|
@ ./node_modules/@lefreet/vue-form/index.js 5:0-57 15:0-25:1
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:9000 webpack/hot/dev-server ./src/main.jsERROR in ./node_modules/@lefreet/vue-form/src/components/field-date.vue 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.|
|
@ ./node_modules/@lefreet/vue-form/index.js 10:0-49 15:0-25:1
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:9000 webpack/hot/dev-server ./src/main.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.