You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
435 B
19 lines
435 B
|
3 years ago
|
import {
|
||
|
|
isFn
|
||
|
|
} from 'uni-shared'
|
||
|
|
|
||
|
|
import {
|
||
|
|
PAGE_LIFECYCLE
|
||
|
|
} from '../constants'
|
||
|
|
|
||
|
|
export function parsePageMethods (mpComponentOptions, vueComponentOptions) {
|
||
|
|
const methods = Object.create(null)
|
||
|
|
Object.keys(mpComponentOptions).forEach(key => {
|
||
|
|
const value = mpComponentOptions[key]
|
||
|
|
if (isFn(value) && PAGE_LIFECYCLE.indexOf(key) === -1) {
|
||
|
|
methods[key] = value
|
||
|
|
}
|
||
|
|
})
|
||
|
|
vueComponentOptions.methods = methods
|
||
|
|
}
|