How to use the @tarojs/utils.getCurrentPageUrl function in @tarojs/utils

To help you get started, we’ve selected a few @tarojs/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro / packages / taro-alipay / src / create-component.js View on Github external
}

        // merge App router params
        const app = getApp()
        if (
          app.$router &&
          app.$router.params &&
          app.$router.params.query &&
          Object.keys(app.$router.params.query).length &&
          getCurrentPages().length === 1
        ) {
          Object.assign(this.$component.$router.params, options, app.$router.params.query)
        } else {
          Object.assign(this.$component.$router.params, options)
        }
        this.$component.$router.path = getCurrentPageUrl()

        // preload
        if (cacheDataHas(options[preloadPrivateKey])) {
          this.$component.$preloadData = cacheDataGet(options[preloadPrivateKey], true)
        } else {
          this.$component.$preloadData = null
        }

        initComponent.apply(this, [isPage])
      },
github NervJS / taro / packages / taro-qq / src / create-component.js View on Github external
this.$component.__isReady = true
  // 页面Ready的时候setData更新,此时并未didMount,触发observer但不会触发子组件更新
  // 小程序组件ready,但是数据并没有ready,需要通过updateComponent来初始化数据,setData完成之后才是真正意义上的组件ready
  // 动态组件执行改造函数副本的时,在初始化数据前计算好props
  if (!isPage) {
    const compid = this.data.compid
    if (compid) {
      propsManager.observers[compid] = {
        component: this.$component,
        ComponentClass
      }
    }
    const nextProps = filterProps(ComponentClass.defaultProps, propsManager.map[compid], this.$component.props)
    this.$component.props = nextProps
  } else {
    this.$component.$router.path = getCurrentPageUrl()
  }
  mountComponent(this.$component)
}
github NervJS / taro / packages / taro-jd / src / create-component.js View on Github external
this.$component.__isReady = true
  // 页面Ready的时候setData更新,此时并未didMount,触发observer但不会触发子组件更新
  // 小程序组件ready,但是数据并没有ready,需要通过updateComponent来初始化数据,setData完成之后才是真正意义上的组件ready
  // 动态组件执行改造函数副本的时,在初始化数据前计算好props
  if (!isPage) {
    const compid = this.data.compid
    if (compid) {
      propsManager.observers[compid] = {
        component: this.$component,
        ComponentClass
      }
    }
    const nextProps = filterProps(ComponentClass.defaultProps, propsManager.map[compid], this.$component.props, this.data.extraProps)
    this.$component.props = nextProps
  } else {
    this.$component.$router.path = getCurrentPageUrl()
  }
  mountComponent(this.$component)
}
github NervJS / taro / packages / taro-weapp / src / create-component.js View on Github external
this.$component.__isReady = true
  // 页面Ready的时候setData更新,此时并未didMount,触发observer但不会触发子组件更新
  // 小程序组件ready,但是数据并没有ready,需要通过updateComponent来初始化数据,setData完成之后才是真正意义上的组件ready
  // 动态组件执行改造函数副本的时,在初始化数据前计算好props
  if (!isPage) {
    const compid = this.data.compid
    if (compid) {
      propsManager.observers[compid] = {
        component: this.$component,
        ComponentClass
      }
    }
    const nextProps = filterProps(ComponentClass.defaultProps, propsManager.map[compid], this.$component.props, this.data.extraProps)
    this.$component.props = nextProps
  } else {
    this.$component.$router.path = getCurrentPageUrl()
  }
  mountComponent(this.$component)
}
github NervJS / taro / packages / taro-tt / src / create-component.js View on Github external
}
      this.$component._init(this)
      this.$component.render = this.$component._createData
      this.$component.__propTypes = ComponentClass.propTypes
      if (isPage) {
        if (cacheDataHas(PRELOAD_DATA_KEY)) {
          const data = cacheDataGet(PRELOAD_DATA_KEY, true)
          this.$component.$router.preload = data
        }
        Object.assign(this.$component.$router.params, options)
        if (cacheDataHas(options[preloadPrivateKey])) {
          this.$component.$preloadData = cacheDataGet(options[preloadPrivateKey], true)
        } else {
          this.$component.$preloadData = {}
        }
        this.$component.$router.path = getCurrentPageUrl()
        initComponent.apply(this, [ComponentClass, isPage])
      }
    },
    attached () {
github NervJS / taro / packages / taro-swan / src / create-component.js View on Github external
created (options = {}) {
      isPage && (hasPageInited = false)
      this.$component = new ComponentClass({}, isPage)
      this.$component._init(this)
      this.$component.render = this.$component._createData
      this.$component.__propTypes = ComponentClass.propTypes
      Object.assign(this.$component.$router.params, options)
      if (isPage) {
        if (cacheDataHas(PRELOAD_DATA_KEY)) {
          const data = cacheDataGet(PRELOAD_DATA_KEY, true)
          this.$component.$router.preload = data
        }
        this.$component.$router.path = getCurrentPageUrl()
        initComponent.apply(this, [ComponentClass, isPage])
      }
    },
    attached () {

@tarojs/utils

Utils for Taro

MIT
Latest version published 4 years ago

Package Health Score

70 / 100
Full package analysis