关于 vue.js:在 weex 中初始化一个全局 mixin | 珊瑚贝

initialising a global mixin in weex


我使用 weex create awesome-project 初始化了一个 weex 和 vue 应用程序。在 entry.js 文件中,我试图注册一个全局 mixin,但它似乎没有注册。代码是:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import weex from ‘weex-vue-render’
import Vue from ‘vue’

Vue.mixin({
  computed: {
    device () {
      return ‘mobile’
    },
    browser () {
      return this.device === ‘browser’
    },
    mobile () {
      return this.device === ‘mobile’
    }
  }
})

weex.init(Vue)

没有一个组件有 this.mobile 为真。在网络模拟器中工作正常,但当我在手机上扫描二维码时就不行了。


仅供参考。好像我刚刚有一个损坏的 Weex 版本!如果你发现自己遇到了这个问题,只需更新 Weex,启动一个新项目并将所有代码移过来。对我来说就像一个魅力。


来源:https://www.codenong.com/49109239/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_10208.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?