我将道具传递给组件:
<template>
{{messageId}}
// other html code
</template>
<script>
export default {
props: ['messageId'],
data: function(){
var theData={
// below line gives ReferenceError messageId is not defined
somevar: messageId,
// other object attributes
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我已经评论了产生错误的行.如果我删除该行,它将正常工作并且模板呈现正确(我也可以看到{{messageId}}的预期值).因此传递数据的逻辑是正确的.
似乎访问messageIdin data()的方式是错误的.那么如何访问messageId数据中的道具呢?
调试我的visual studio 2010网站时出现以下错误:
尝试为文件C:\ Users ...\Desktop\Dpp2012New\App_Data\dppdatabase.mdf附加自动命名的数据库失败.存在具有相同名称的数据库,或者无法打开指定的文件,或者它位于UNC共享上.
描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:System.Data.SqlClient.SqlException:尝试为文件C:\ Users ...\Desktop\Dpp2012New\App_Data\dppdatabase.mdf附加自动命名的数据库失败.存在具有相同名称的数据库,或者无法打开指定的文件,或者它位于UNC共享上.
这是我的连接字符串web.config:
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient"/>
<add name="ConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\dppdatabase.mdf;Integrated Security=SSPI"
providerName="System.Data.SqlClient"/>
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
我从我的网站访问它:
Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
Run Code Online (Sandbox Code Playgroud)
stacktrace将错误行显示为:
Dim conn As New SqlConnection(connectionString)
Dim dr As SqlDataReader
conn.Open() 'This is the error line as per stacktrace
Run Code Online (Sandbox Code Playgroud)
我已经给上述文件夹所需的权限,因此它不能是"或指定的文件无法打开"的问题.如果我们查看与此论坛中相同错误相关的所有帖子,显然可以找到此错误的深刻性.但是,没有一个解决方案可以解决我的问题.我尝试过的一些资源是:
我急切地等待解决方案.
这是我的RequestList.vue组件
<template>
<ion-item v-for="request in requests" @click="showRequest(request)" :key="request.id"
text-wrap>
<ion-label>
<b>Name:</b> {{ request.event.name }}
<br>
<b>Venue:</b>{{ request.event.venue.name }}
<br>
<b>Date:</b> {{ request.event.date }}
</ion-label>
</ion-item>
</template>
<script>
import {useRouter} from 'vue-router'
import {IonItem, IonLabel} from '@ionic/vue'
import store from '@/store';
export default {
components: {
IonLabel,
IonItem
},
props: {
requests: Array
},
setup(props) {
const router = useRouter()
const showRequest= (request)=> {
console.log('request', props.request);
store.requests.setRequest(props.requests);
};
return {router, showRequest}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
我的store/modules/requests.js档案
import {computed, …Run Code Online (Sandbox Code Playgroud) 我正在阅读有关AST(抽象语法树)的内容,但我看到的所有示例都使用了以下表达式:
a + b * c
Run Code Online (Sandbox Code Playgroud)
哪个可以用类似lispy的语法表示为:
(+ a (* b c) )
Run Code Online (Sandbox Code Playgroud)
这相当于:
+
/ \
a *
/ \
b c
Run Code Online (Sandbox Code Playgroud)
我的问题是OOPL中一个类的AST会是什么样子?
我天真的尝试是为了这个Java代码:
class Person {
String name;
int age;
public String toString() {
return "name";
}
}
Run Code Online (Sandbox Code Playgroud)
方法是:
;Hand written
(classDeclaration Person
(varDeclaration String name)
(varDeclaration int age )
(funcDeclaration String toString
(return "name")
)
)
Run Code Online (Sandbox Code Playgroud)
但我不太确定我对真正的AST代表有多近或多远.
这取决于我选择的语言.需要多少细节?这些"xyzDeclaraction"是否需要或可能如下:
(Person (String name) (int age))
Run Code Online (Sandbox Code Playgroud)
在哪里可以看到实际编程语言的"真实"表示以了解更多信息.
java compiler-construction programming-languages abstract-syntax-tree
目前我在64位Windows 8.1上使用intellij idea 14.0.3(之前我使用的是12.1.4).
当我们安装它时,安装程序会在开始菜单和其他位置创建快捷方式,即使在64位系统上也默认为32位.exe文件.
我知道我可以使用64位可执行文件在64位模式下运行想法,如本 SO答案所示.
但两个版本的IDE之间是否存在显着的性能差异?
建议64位系统使用哪个可执行文件?我要继续使用32位吗?或者我应该切换到64位版本?
目前我要看几个属性.如果每个都改变了,我必须调用相同的函数:
export default{
// ...... rest of code
watch: {
propa: function(after,before) {
doSomething(after,before);
},
propb: function(after,before) {
doSomething(after,before);
}
// ... so on
}
}
Run Code Online (Sandbox Code Playgroud)
所以我不得不多次编写相同的代码.是否可以简单地监视所有属性并调用其更改处理程序而无需多次编写相同的代码?
PS:我正在使用vue 1.x.
我正在使用intellij idea终极版12.1.4并尝试将maven与项目一起使用.这是我的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fasterxml</groupId>
<artifactId>oss-parent</artifactId>
<version>10</version>
</parent>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.2</version>
<name>jackson-databind</name>
<description>General data-binding functionality for Jackson: works on core streaming API</description>
<url>http://wiki.fasterxml.com/JacksonHome</url>
<scm>
<connection>scm:git:git@github.com:FasterXML/jackson-databind.git</connection>
<developerConnection>scm:git:git@github.com:FasterXML/jackson-databind.git</developerConnection>
<url>http://github.com/FasterXML/jackson-databind</url>
<tag>jackson-databind-2.2.2</tag>
</scm>
<properties>
<osgi.export>
com.fasterxml.jackson.databind,
com.fasterxml.jackson.databind.annotation,
com.fasterxml.jackson.databind.cfg,
com.fasterxml.jackson.databind.deser,
com.fasterxml.jackson.databind.deser.impl,
com.fasterxml.jackson.databind.deser.std,
com.fasterxml.jackson.databind.exc,
com.fasterxml.jackson.databind.ext,
com.fasterxml.jackson.databind.introspect,
com.fasterxml.jackson.databind.jsonschema,
com.fasterxml.jackson.databind.jsonFormatVisitors,
com.fasterxml.jackson.databind.jsontype,
com.fasterxml.jackson.databind.jsontype.impl,
com.fasterxml.jackson.databind.module,
com.fasterxml.jackson.databind.node,
com.fasterxml.jackson.databind.ser,
com.fasterxml.jackson.databind.ser.impl,
com.fasterxml.jackson.databind.ser.std,
com.fasterxml.jackson.databind.type,
com.fasterxml.jackson.databind.util
</osgi.export>
<osgi.import>
com.fasterxml.jackson.annotation,
com.fasterxml.jackson.core,
com.fasterxml.jackson.core.base,
com.fasterxml.jackson.core.format,
com.fasterxml.jackson.core.json,
com.fasterxml.jackson.core.io,
com.fasterxml.jackson.core.util,
com.fasterxml.jackson.core.type,
org.xml.sax,org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.ls,
javax.xml.datatype, javax.xml.namespace, javax.xml.parsers
</osgi.import>
<!-- Generate PackageVersion.java into …Run Code Online (Sandbox Code Playgroud) 我正在动态地将脚本标记放到我的页面的DOM中,如下所示:
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
Run Code Online (Sandbox Code Playgroud)
这应该生成这样的东西:
<script src="https://www.youtube.com/iframe_api"></script>
Run Code Online (Sandbox Code Playgroud)
我只想对此脚本标记进行延迟或异步,如下所示:
<script src="https://www.youtube.com/iframe_api" defer async></script>
Run Code Online (Sandbox Code Playgroud)
那么我该如何使用javascript做到这一点?
我想从命令行传递自定义参数.像这样的东西:
webpack-dev-server --inline --hot --customparam1=value
Run Code Online (Sandbox Code Playgroud)
我正在努力实现的是我正在开发一个vue-loader应用程序.该应用程序具有某些获取数据的服务.
我有另一个充当api服务器的应用程序.我们需要以两种方式运行应用程序(因为我们团队的所有成员都无法访问api服务器)
因此该服务有两种获取数据的方式:
1)如果api服务器正在运行(对于开发团队),请使用http调用从localhost获取数据
2)如果api服务器没有运行(对于设计团队),只需使用服务中已存在的静态数据:
var someData;
if (customparam1 === "withApi"){
someData=getData("http://localhost:8081/apiendpoint");
} else {
someData=[
{a:b},
{c:d},
// more custom array of static data
.....
]
}
Run Code Online (Sandbox Code Playgroud)
所以这个customparam1应该从webpack-dev-server命令行传递,根据这个文档,我找不到这样的方法(我错过了什么?)
我该怎么做?
PS:我在webpack 1.12.1上
我想知道它是否可以下载只说谷歌电子表格的第1页作为excel?我看到很少有SO帖子显示将WHOLE表格导出为excel的方法,但我只需要导出一张表格.它可能吗?如果是,怎么样?
vue-loader ×3
java ×2
vue.js ×2
asp.net ×1
asp.net-4.0 ×1
ecmascript-6 ×1
javascript ×1
jquery ×1
maven ×1
unc ×1
vb.net ×1
vuejs3 ×1
webpack ×1