article icon indicating copy to clipboard operation
article copied to clipboard

weex-vue-render 12.14

Open Kntt opened this issue 7 years ago • 3 comments

image

使用requireModule, 返回的是undefined, 无论dom还是其他模块都是这样

export function initIconFont () {
  var bundleUrl = weex.config.bundleUrl
  var url = bundleUrl.split('/').slice(0, -1).join('/');
  if (url.indexOf('#') !== -1) {
    url = url.slice(0, url.indexOf('#') - 1)
  }
  console.log(url)
  var dom = weex.requireModule('dom').addRule('fontFace', {
    'fontFamily': "iconfont",
    'src': `url('${url}static/fonts/iconfont.ttf')`
  });
  console.log(dom)  // undefined
}

但是直接用:

weex.requireModule('dom').addRule('fontFace', {
    'fontFamily': "iconfont",
    'src': `url('${url}static/fonts/iconfont.ttf')`
  })

Kntt avatar Sep 18 '17 10:09 Kntt

const storage = weex.requireModule('storage')
// the storage is undefined!

me too!help!!!

Yuamo avatar Sep 21 '17 06:09 Yuamo

 "weex-vue-render": "^0.11.57"

Yuamo avatar Sep 21 '17 07:09 Yuamo

貌似不能赋值,只能直接使用weex.requireModule('dom'). getComponentRect

或者

this.dom.getComponentRect()这样用。

computed: {
    dom() {
      return weex.requireModule('dom')
    },
}

CodeDreamfy avatar Apr 08 '18 08:04 CodeDreamfy