我一直在 Nuxt 中使用 firebase,但是随着 2.5.0 升级,我收到了这些错误。似乎无法弄清楚问题是什么?
ERROR Failed to compile with 7 errors friendly-errors 13:21:54
These dependencies were not found: friendly-errors 13:21:54
friendly-errors 13:21:54
* core-js/fn/array/find in ./node_modules/@firebase/polyfill/dist/index.esm.js friendly-errors 13:21:54
* core-js/fn/array/find-index in ./node_modules/@firebase/polyfill/dist/index.esm.js friendly-errors 13:21:54
* core-js/fn/object/assign in ./node_modules/@firebase/polyfill/dist/index.esm.js friendly-errors 13:21:54
* core-js/fn/string/repeat in ./node_modules/@firebase/polyfill/dist/index.esm.js friendly-errors 13:21:54
* core-js/fn/string/starts-with in ./node_modules/@firebase/polyfill/dist/index.esm.js friendly-errors 13:21:54
* core-js/fn/symbol in ./node_modules/@firebase/polyfill/dist/index.esm.js friendly-errors 13:21:54
* core-js/fn/symbol/iterator in ./node_modules/@firebase/polyfill/dist/index.esm.js friendly-errors 13:21:54
friendly-errors 13:21:54
To install them, you can run: npm install --save core-js/fn/array/find core-js/fn/array/find-index core-js/fn/object/assign …Run Code Online (Sandbox Code Playgroud) 如何通过GET处理Play Framework 2.0 JAVA中的多个复选框?
该网址类似于:http://localhost:9000/games?type=platform&type=role.如何在控制器的"Set"变量中获取两个"类型"值?
我的表单看起来像这样:
<input type="checkbox" name="type[]" class="" value="all-types">
<input type="checkbox" name="type[]" class="" value="platform">
<input type="checkbox" name="type[]" class="" value="role">
Run Code Online (Sandbox Code Playgroud)
谢谢!
因此,我正在使用 Firestore 和 Nuxt 开发一个 Web 应用程序,当我进行身份验证时,我想确保我遵循最佳实践。
使用 Firebase 身份验证只会给我一个标识符(在这种情况下是电子邮件)和一个 UID。然后我创建了一个用户集合来存储其他数据,例如:
{
"UID": "6TIupYLKlcOE97b5Fe63uinf6Ik1",
"app_metadata": {
"role": "admin",
"status": "approved"
},
"firstName": "Jon",
"lastName": "Doe"
}
Run Code Online (Sandbox Code Playgroud)
目前,在用户通过身份验证以获取用户角色后,我正在执行以下操作:
// Getting user details
db.collection('users')
.where('UID', '==', user.uid)
.limit(1)
.get()
.then((snapshot) => {
snapshot.forEach(doc => {
console.log(doc.id, '=>', doc.data().app_metadata.role)
dispatch('setROLE', doc.data().app_metadata.role)
})
})
.catch((err) => {
console.log('Error getting documents', err);
})
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来处理存储额外的用户数据并将其与 Firebase 身份验证联系在一起?
我是铁杆的新手,我一直在寻找这个问题的答案.这就是我所拥有的:
class Item < ActiveRecord::Base
belongs_to :book
class Book < ActiveRecord::Base
has_many :items
Run Code Online (Sandbox Code Playgroud)
现在我想列出所有项目及其属性和与之相关的书籍.它们将在items_controller.rb中的索引下
class ItemsController < ApplicationController
# GET /items
# GET /items.xml
def index
@items = Item.all
Run Code Online (Sandbox Code Playgroud)
现在我如何处理ItemsController中的书籍,以便我可以在index.html.erb中列出它们,记住一个项目只属于一本书?如果我补充:
@books = items.book.find
Run Code Online (Sandbox Code Playgroud)
在@items = Item.all下,所以我可以在index.html.erb中引用它们我得到:
#<Array:0x10427f998>的未定义方法'book'
我觉得答案很简单,但到目前为止我还没弄明白.有没有你们知道的教程可以解决这个问题?
谢谢!
当我有:
public class User extends Model {
@Id
public Long id;
@Constraints.Required
@Formats.NonEmpty
public String username;
Run Code Online (Sandbox Code Playgroud)
public String firstName; public String lastName;
我可以做User.find.byUsername("myusername")或者User.find.byFirstNameAndLastName...我必须在User类中定义方法吗?
谢谢!