lib-js-wild-vue
lib-js-wild-vue copied to clipboard
文档说明不够清楚啊..
文档说明不够清楚啊..
在组件化的方式下应该怎么使用?
顶!组件化下根本用不出来现在
然而半个月过去了,根本没有人回复.. 不敢用了。
给你我的代码 import WildVue from 'wildvue'; import Wilddog from 'wilddog';
Vue.use(WildVue);
var wilddogApp = Wilddog.initializeApp({ authDomain: 'your.wilddog.com',//注意这里两个地址不一样 syncURL: 'https://you.wilddogio.com' }); var sync = wilddogApp.sync();
var actions = { getData(context, object) { var progress = object.progress; var isRefresh = object.refresh; progress.$Progress.start(); context.commit('updateLoadingState', false); context.commit('updateBusyState', true);
sync.ref('posts').orderByChild('time').limitToLast(100000000).on('value', function(ss) {
var array = [];
var val = ss.val();
// var i = 0; for debug
for (var k in val) {
// i++;
if (val.hasOwnProperty(k)) {
if (val[k].img == undefined) {
continue;
}
array.push(val[k]);
}
// if (i > 10)
// break;
}
console.log('load ' + array.length + ' posts');
var result = array.reverse();
context.commit('addData', result);
context.commit('updateLoadingState', true);
context.commit('updateBusyState', false);
progress.$Progress.finish();
});
}
};
感谢感谢。 其实我后面自己也琢磨得了。 wilddog 公众号更新挺勤快的,不知道为何不看 github issue..
组件化的引用写的不清楚