12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- module.exports = {
- data() {
- return {}
- },
- onLoad() {
-
- this.$u.getRect = this.$uGetRect
- },
- methods: {
-
-
-
- $uGetRect(selector, all) {
- return new Promise(resolve => {
- uni.createSelectorQuery().
- in(this)[all ? 'selectAll' : 'select'](selector)
- .boundingClientRect(rect => {
- if (all && Array.isArray(rect) && rect.length) {
- resolve(rect)
- }
- if (!all && rect) {
- resolve(rect)
- }
- })
- .exec()
- })
- },
- getParentData(parentName = '') {
-
- if(!this.parent) this.parent = false;
-
-
-
- this.parent = this.$u.$parent.call(this, parentName);
- if(this.parent) {
-
- Object.keys(this.parentData).map(key => {
- this.parentData[key] = this.parent[key];
- });
- }
- },
-
- preventEvent(e) {
- e && e.stopPropagation && e.stopPropagation()
- }
- },
- onReachBottom() {
- uni.$emit('uOnReachBottom')
- },
- beforeDestroy() {
-
-
- if(this.parent && uni.$u.test.array(this.parent.children)) {
-
- const childrenList = this.parent.children
- childrenList.map((child, index) => {
-
- if(child === this) {
- childrenList.splice(index, 1)
- }
- })
- }
- }
- }
|