1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- export default {
- 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];
- });
-
- this.parentData.value = this.parent.modelValue;
-
- }
- },
-
- 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)
- }
- })
- }
- },
-
-
-
- beforeUnmount() {
-
-
- 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)
- }
- })
- }
- },
-
- }
|