UNPKG

zmp-vue

Version:

Build full featured iOS & Android apps using ZMP & Vue

18 lines (17 loc) 534 B
import { onMounted, onUpdated } from 'vue'; export var useRouteProps = function useRouteProps(elRef, _temp) { var _ref = _temp === void 0 ? {} : _temp, routeProps = _ref.routeProps; onMounted(function () { if (elRef.value && routeProps) { elRef.value.zmpRouteProps = routeProps; } }); onUpdated(function () { if (elRef.value && routeProps) { elRef.value.zmpRouteProps = routeProps; } else if (elRef.value && elRef.value.zmpRouteProps) { delete elRef.value.zmpRouteProps; } }); };