Vue.prototype.$url = 'https://car.shengdianhao.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常

- 发布:2023-04-27 14:13
- 更新:2023-04-27 18:27
- 阅读:352
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 10
HBuilderX类型: 正式
HBuilderX版本号: 3.7.10
第三方开发者工具版本号: 1.06.2301160 win32-x64
基础库版本号: 2.30.4
项目创建方式: HBuilderX
示例代码:
操作步骤:
Vue.prototype.$url = 'https://car.shengdianhao.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常
Vue.prototype.$url = 'https://car.shengdianhao.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常
预期结果:
Vue.prototype.$url = 'https://car.shengdianhao.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常
Vue.prototype.$url = 'https://car.shengdianhao.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常
实际结果:
Vue.prototype.$url = 'https://car.shengdianhao.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常
Vue.prototype.$url = 'https://car.shengdianhao.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常
bug描述:
Vue.prototype.$url = 'https://car.shssenssgdissanhasso.cn'
```在main.js里这样写 页面上用{{$url}}小程序是undefined app和h5都正常
1 个回复
YUANRJ
小程序不支持在模板中访问全局变量,可以在计算属性定义下。