摘要: let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1) hashes = decodeURI(hashes) hashes = hashes.split('&') 阅读全文
posted @ 2021-02-25 10:05 呱呱呱呱坠地 阅读(89) 评论(0) 推荐(0)
摘要: APP-PLUS App APP-PLUS-NVUE或APP-NVUE App nvue H5 H5 MP-WEIXIN 微信小程序 MP-ALIPAY 支付宝小程序 MP-BAIDU 百度小程序 MP-TOUTIAO 字节跳动小程序 MP-QQ QQ小程序 MP-360 360小程序 MP 微信小 阅读全文
posted @ 2021-01-05 11:41 呱呱呱呱坠地 阅读(158) 评论(0) 推荐(0)
摘要: 小程序中有个globalData概念,可以在 App 上声明全局变量。 Vue 之前是没有这类概念的,但 uni-app 引入了globalData概念,并且在包括H5、App等平台都实现了。 在 App.vue 可以定义 globalData ,也可以使用 API 读写这个值。 globalDat 阅读全文
posted @ 2021-01-05 09:42 呱呱呱呱坠地 阅读(2174) 评论(0) 推荐(0)
摘要: 将一些使用频率较高的常量或者方法,直接扩展到 Vue.prototype 上,每个 Vue 对象都会“继承”下来。 注意这种方式只支持vue页面 示例如下: 在 main.js 中挂载属性/方法 Vue.prototype.websiteUrl = 'http://uniapp.dcloud.io' 阅读全文
posted @ 2021-01-05 09:38 呱呱呱呱坠地 阅读(3165) 评论(0) 推荐(0)
摘要: 在 uni-app 项目根目录下创建 common 目录,然后在 common 目录下新建 helper.js 用于定义公用的方法。 const websiteUrl = 'http://uniapp.dcloud.io'; const now = Date.now || function () { 阅读全文
posted @ 2021-01-05 09:33 呱呱呱呱坠地 阅读(972) 评论(0) 推荐(0)
摘要: <!-- 父组件 --> <template> <view> <syncA :title.sync="title"></syncA> </view> </template> <script> export default { data() { return { title:"hello vue.js 阅读全文
posted @ 2021-01-04 16:07 呱呱呱呱坠地 阅读(212) 评论(0) 推荐(0)
摘要: <template> <view> <!-- 我是父组件 --> <componentA @click.native="clickComponentA" style="height: 200px;"></componentA> </view> </template> <script> export 阅读全文
posted @ 2021-01-04 16:04 呱呱呱呱坠地 阅读(188) 评论(0) 推荐(0)
摘要: <script> export default { props: { // 检测类型 + 其他验证 age: { type: Number, default: 0, required: true, validator: function(value) { return value >= 0 } } 阅读全文
posted @ 2021-01-04 15:51 呱呱呱呱坠地 阅读(423) 评论(0) 推荐(0)
摘要: 通过uni-app的easycom: 将组件引入精简为一步。只要组件安装在项目的 components 目录下,并符合 components/组件名称/组件名称.vue 目录结构。就可以不用引用、注册,直接在页面中使用。 <!-- 在index.vue引入 uni-badge 组件--> <temp 阅读全文
posted @ 2021-01-04 15:18 呱呱呱呱坠地 阅读(671) 评论(0) 推荐(0)
摘要: <script> export default { data() { return { a: 1, b: 2, c: 3, d: 4, e: { f: { g: 5 } } } }, watch: { a: function(val, oldVal) { console.log('new: %s, 阅读全文
posted @ 2021-01-04 14:55 呱呱呱呱坠地 阅读(151) 评论(0) 推荐(0)