为什么在这种情况下:
var ele = <HTMLDivElement>document.getElementById("toolbar");
ele.addEventListener("click", function (e) {
if (e.target.tagName === "SPAN") { console.log(e.target.tagName) } }, false);
Run Code Online (Sandbox Code Playgroud)
Visual Studio向我显示此错误?
构建:运算符'==='不能应用于类型'HTMLElement'和'string'.
'EventTarget'类型中不存在属性'tagName'.
当我运行脚本工作正常.
怎么写得好呢?
谢谢.
我最近几天尝试解决这个问题,但仍然没有成功。如果我在没有 proguard 的情况下构建发布版本,则一切正常。
我阅读了许多关于可能出现的问题的主题,但对我的情况没有任何帮助。到目前为止,我做了如下:
一般安卓 -dontwarn org.apache.http.** -dontwarn android.net.http.AndroidHttpClient
安卓支持库
-保持类android.support.multidex.MultiDexApplication
-保持类android.support.v4.**
-保持类android.support.v7.** { public *; }
Google Play 结算
- 保持类 com.android.vending.billing.**
谷歌播放服务
-dontwarn com.google.android.gms.internal.*
-keep class * extends java.util.ListResourceBundle { protected java.lang.Object[][] getContents(); }
结果是 0 个警告和 1 个错误。
错误: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1929,3):错误 MSB6006:“java.exe”以代码 1 退出.
我还可以做些什么?请帮忙。
更新。 我创建了全新的应用程序“Xamarin Hello World”,并且“ProGuard”可以正常工作。所以我的应用程序一定是有问题而不是系统。但是除了 Java 代码 1 之外,visual studio 没有向我显示任何其他错误。那么如何跟踪问题出在哪里呢?
更新 …
我制作了一个“OffersPlugin”,在“安装”功能期间从服务器获取一些数据。vue 中加载的第一个组件需要该数据。但在加载 vue 组件之前,http 请求无法完成,而且我没有任何数据可使用。
我怎样才能告诉 vue 在插件准备好之前保持 init vue ?
谢谢。
import Vue from 'vue';
import VueCookie from 'vue-cookie';
import App from './ExampleComponent';
import OffersPlugin from '../plugins/OffersPlugin';
Vue.use(VueCookie);
Vue.use(OffersPlugin);
if(document.getElementById("vue-promotion-edit-section")) {
new Vue({
render: h => h(App)
}).$mount('#vue-promotion-edit-section');
Run Code Online (Sandbox Code Playgroud)
在安装方法中,我有 axios GET 请求。在该请求中,我从服务器加载报价列表。当请求成功时,我将插件变量关联到数组:
const offerList = [];
Run Code Online (Sandbox Code Playgroud)
我使用 getOfferId 方法作为原型。
function(name)
{
return offersList[name] || 'No offer'
}
Run Code Online (Sandbox Code Playgroud) 我有一个表的用户和帖子的列USER_ID和post_views。在post_views中,我保留了显示多少次帖子的信息。
现在,在查询中,我想让用户获得其所有帖子的post_views之和。
我试图做这样的事情:
User::where(['id'=>$id])->with('posts')->get();
Run Code Online (Sandbox Code Playgroud)
在模型中,我定义了:
public function posts()
{
return $this->hasMany('App\Models\Post')->sum('post_views','AS','totalViews');
}
Run Code Online (Sandbox Code Playgroud)
但是没有成功。
怎么做?
谢谢
有人可以解释一下为什么我有错误吗
路径中不允许有查询字符串
我使用 OpenApi 3.0.1,并遵循本文档,其中描述了这部分代码。所以这个错误不应该出现,但是却出现了,为什么呢?
/posts/{postid}?offset=0&limit=5:
get:
tags:
- posts
summary: example
description: 'example text'
operationId: getComments
parameters:
- name: postId
in: path
description: Post id
required: true
schema:
type: string
- name: offset
in: query
schema:
type: integer
description: The number of items to skip before starting to collect the result set
required: false
- in: query
name: limit
schema:
type: integer
description: The numbers of items to return
required: false
responses:
200:
description: example desc
content:
application/json:
schema: …Run Code Online (Sandbox Code Playgroud) 在Laravel中是否可以创建一个查询,该查询从3个不同的不相关表中分别对所有记录进行计数?而且不使用口才。
示例:我有三个表A,B,C。我可以进行三个单独的查询,该查询将计算每个表中的所有记录。就像“ DB :: table('A')-> count();”
但是我需要一个查询来执行此操作。$ all = DB :: ??
由于这个变量,我将得到类似:
$all->A
$all->B
$all->C
Run Code Online (Sandbox Code Playgroud)
谢谢。
我正在尝试使用 postgres db 运行 Laravel。Docker 构建工作正常,我可以通过 url 访问应用程序,并且可以连接到数据库。但 laravel 无法建立与数据库的连接。
但是当我在 env 文件中使用相同的凭据时:
然后我有以下错误。
Doctrine\DBAL\Driver\PDOException : SQLSTATE[08006] [7] 无法连接到服务器:连接被拒绝 服务器是否在主机“127.0.0.1”上运行并接受端口 5432 上的 TCP/IP 连接?
在 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31 27| 父::__construct($dsn, (字符串) $user, (字符串) $password, (数组) $options); 28| $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDOStatement::class, []]); 29| $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 30| } catch (\PDOException $异常) {
31| 抛出新的 PDOException($Exception); 32| } 33| } 34| 35| /**
Docker 配置: docker-compose
version: '3'
services:
postgis:
image: postgis/postgis
volumes:
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
environment:
POSTGRES_USER: admin_db
POSTGRES_PASSWORD: test123
ports:
- '5432:5432' …Run Code Online (Sandbox Code Playgroud) laravel ×3
javascript ×2
database ×1
docker ×1
eloquent ×1
postgis ×1
postgresql ×1
swagger ×1
typescript ×1
vue.js ×1
vuejs2 ×1
xamarin ×1