小编bee*_*ern的帖子

如何从 Vuex 操作访问 Nuxt 上下文变量

我想访问上下文变量以使用该isMobile标志根据结果选择不同的端点。我可以从组件中传递它dispatch,但我知道应该有一种方法可以做到这一点。

export const actions = {
...
  signUpGoogle({ commit }) {
    fireauth.useDeviceLanguage()

    if (context.isMobile) {
      fireauth.signInWithPopup(GoogleProvider).then ...

    } else {
      fireauth.signInWithRedirect(GoogleProvider)
    }

}
Run Code Online (Sandbox Code Playgroud)

我在这里看到它可以在服务器初始化上获取,但我真的不想依赖它,因为缓存会把事情搞砸

https://nuxtjs.org/guide/vuex-store/#the-nuxtserverinit-action

谢谢您的帮助

vue.js vuex nuxt.js

6
推荐指数
1
解决办法
4554
查看次数

Changing default datetime format in Cakephp 3

I am using Cake Crud Api plugin and baking all models.

The datetime format in the json response is like this:

"created": "2016-08-01T08:49:11+0000"
Run Code Online (Sandbox Code Playgroud)

I want it to look like a normal datatime:

"created": "2016-08-01 08:49:11"
Run Code Online (Sandbox Code Playgroud)

I have tryied setting application wide:

Time::setJsonEncodeFormat('yyyy-MM-dd HH:mm:ss');
Run Code Online (Sandbox Code Playgroud)

with no luck and also I have searched for any Time reference in the Crud plugin, but I haven't finded out where the default ajax format comes from.

Any idea? Thanks.

php cakephp cakephp-3.0

4
推荐指数
1
解决办法
2294
查看次数

如何以编程方式更改linux的文件编码?

是否有任何程序可以通过编程方式将文件编码更改为UTF-8.我有1000个文件,我想在linux中以UTF-8格式保存它们.

谢谢.

linux utf-8

2
推荐指数
1
解决办法
972
查看次数

标签 统计

cakephp ×1

cakephp-3.0 ×1

linux ×1

nuxt.js ×1

php ×1

utf-8 ×1

vue.js ×1

vuex ×1