Invalid access token. Check the value of the Authorization HTTP request header.我在这里做错了什么?
在彻底研究了这个问题并且在实现Bus方法之间进行兄弟姐妹之间的通信之后,我收到了一个webpack错误,所以要么我没有正确实现(使用最新的CLI截至昨天),要么我需要一些其他方法.
我是Vue的新手,来自React,我已经构建了一个包含2个组件的简单app app.vue:
发送数据的输入:
<GoogleInput @searchEvent="getSearchLocation($event)"></GoogleInput>
Run Code Online (Sandbox Code Playgroud)
和一个应该接收数据的地图容器:
<GoogleMapsContainer :location="location" name="location-project"></GoogleMapsContainer>
Run Code Online (Sandbox Code Playgroud)
我GoogleInput在app.jsvia中成功实现了child()到父通信:
getSearchLocation(input) {
this.location = input;
}
Run Code Online (Sandbox Code Playgroud)
用一种方法GoogleInput:
this.$emit('searchEvent', ev.target.value);
到目前为止,一切都很顺利.
然而,当尝试GoogleMapsContainer通过总线方法将我的输入值传递给sibling()时:
在我的条目index.js中: const Bus = new Vue({});
我的发送组件中的新发出:
Bus.$emit('passLocation', {location: this.location})
在我的接收组件中:
Bus.$on('passLocation', (input) => {
this.location = input;
});
我收到一个webpack错误:
Error in created hook: "TypeError: __WEBPACK_IMPORTED_MODULE_1_vue__.$on is not a function"
我正在寻找"最短的距离"来传达我的输入到地图容器,而不是解决webpack问题(如果这是一个webpack问题,或只是一个胖手指错误).
顺便说一句:如果vuex不是一个耗时的实现方法(如React-Redux那样),那也是一条很酷的路线,但我必须保持这种设计(已经在Git中)
谢谢
我有一个工作组件,执行以下操作:
created()=> works中的全局总线方法从兄弟输入组件接收字符串geoDecoding()=> works将字符串处理为lat/lng坐标geoDecoding()=> 工作showMap()在事件触发后刷新了更改的数据=> 不起作用 :(请注意,我有带有硬编码默认值的道具(已注释掉),只是为了检查
showMap()这些值,它是有效的.
showMap()我注意到没有设置纬度和经度,这很奇怪,因为我在created()调用它们时设置它们geoDecoding()我showMap()想要刷新每个被触发的事件,它将从this.latLong.latitude/ 获得刷新的数据()this.latLong.longitude并根据这些新值重新实例化地图.在这个目前点位在这里将这些代码实例,我正在showMap()给instatiate地图又映射为空sibce它没有收到来自纬度/经度geoDecoding().
<template>
<div class="map-container" :id="theMap"></div>
</template>
<script>
import { Bus } from "../main";
export default {
name: "GoogleMapsContainer",
data() {
return {
theMap: "map-for-" + this.name,
location: '',
latLong: {
latitude: '',
longitude: ''
},
}
},
props: {
name, …Run Code Online (Sandbox Code Playgroud) 我的Django管理面板显示的object不是self.name对象。
我在这里经历了几个类似的问题,但似乎无法解决此问题。__unicode__并__str__承担相同的结果,无论是书籍和作者。我已经更改了这些行,并在每次更改中都添加了新的作者/书籍,但没有更改。
模型
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Author(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Book(models.Model):
auto_increment_id = models.AutoField(primary_key=True)
name = models.CharField('Book name', max_length=100)
author = models.ForeignKey(Author, blank=False, null=False)
contents = models.TextField('Contents', blank=False, null=False)
def __unicode__(self):
return self.name
Run Code Online (Sandbox Code Playgroud)
我同时使用了unicode和str,结果相同。
以下是按菜单/操作显示的管理面板的屏幕截图。
第一屏
作者名单
单作者
我在这里经历了一些"过多的递归"问题和答案,但每个问题都解决了一个特定问题,但我无法从他们那里推断出一个正确的答案来回答这个代码错误,如何解决它以及为什么我'得到那个错误:
<body>
<input type="number" id="num">
<input type="button" id="submit" onclick="factor()"><br>
<div id="yourResult"></div>
<script>
inputValue = document.getElementById('num').val;
function factor(n){
if(n==0){
return 1;
}
if(n==1){
return 1;
}
return n * factor(n-1);
}
function result() {
$('yourResult').append('<p>your factorial of ' + inputValue + ' equals to: ' + factor()+'</p>');
}
</script>
</body>
Run Code Online (Sandbox Code Playgroud) 我似乎无法将网格分成每行 1 个图像sm。
这是我对 bootstrap 4 的第一次尝试,我检查了那里的网格系统,它指出在给每个大小添加后缀时会发生响应中断,col-但我看不到任何中断。
<div class="container-fluid text-right">
<div class="row">
<div class="col-sm-12 col-md-6">
<div class="card mb-3">
<div class="card-img"
style="background-image:url(https://snap-photos.s3.amazonaws.com/img-thumbs/960w/1U2EGZ07GU.jpg);">
</div>
<div class="card-img-overlay d-flex flex-column justify-content-between">
<h4 class="card-title">das das</h4>
<p class="card-text">lorem oirrwerwer asdf asfd</p>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="card mb-3">
<div class="card-img"
style="background-image:url(https://snap-photos.s3.amazonaws.com/img-thumbs/960w/1U2EGZ07GU.jpg);">
</div>
<div class="card-img-overlay d-flex flex-column justify-content-between">
<h4 class="card-title">das das</h4>
<p class="card-text">lorem oirrwerwer asdf asfd</p>
</div>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
.card {
width: 100%;
height: 300px; …Run Code Online (Sandbox Code Playgroud) javascript ×2
vuejs2 ×2
bearer-token ×1
bootstrap-4 ×1
cookies ×1
css ×1
django ×1
ebay-api ×1
html ×1
postgresql ×1
python ×1
recursion ×1
vue.js ×1