我正在尝试在我的package.json中添加lint-fix。我的基本皮棉是"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
我确实尝试过,"lint-fix": "eslint --fix --ext .js,.vue src test/unit/specs test/e2e/specs"但是它抛出了我的错误,但没有修复它们。
我必须改变什么?
NPM的错误是:
217 problems (217 errors, 0 warnings)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "lint-fix"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! quasar-app@0.0.1 lint-fix: eslint --fix --ext .js,.vue src
npm ERR! Exit status 1
npm ERR! but it is caused by exit code 1 which is result of finding …Run Code Online (Sandbox Code Playgroud) 这不起作用:https://jsfiddle.net/2ouxsuLh/
var myAwesomeComponent = Vue.component({
template: '<div><slot></slot></div>',
data: function () {
return {
myAwesomeData: 'Message'
}
}
});
new Vue({
el: '#app',
template: '<my-awesome-component>{{ myAwesomeData }}</my-awesome-component>',
components: {
myAwesomeComponent: myAwesomeComponent
}
});
Run Code Online (Sandbox Code Playgroud)
这是因为myAwesomeData没有在父组件中定义,我们不能使用组件的变量.
而不是这个,我们需要创建我们自己的组件并将其传递到my-awesome-component中,如下所示:https://jsfiddle.net/simplesmiler/5p420nbe/
但这是开销,不是吗?
例如,在角度我们可以这样做:http://jsfiddle.net/ADukg/9609/ 它更简单.
我们可以在Vue做这样的事情吗?
我正在努力使用 Net Core 3.0 和 React 进行 Identity Server 4 的基本设置(但这几乎无关紧要)。
我已经生成了新的应用程序dotnet new react -au Individual,更新了依赖项等,创建的配置基本上是从演示服务器复制的,内容如下:
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
// JavaScript Client
new Client
{
Enabled = true,
ClientId = "spa",
ClientName = "SPA (Code + PKCE)",
RequireClientSecret = false,
RequireConsent = false,
RedirectUris = { "https://notused" },
PostLogoutRedirectUris = { "https://notused" },
AllowedGrantTypes = GrantTypes.Code,
AllowedScopes = { "openid", "profile", "email", "api" },
AllowOfflineAccess = true,
RefreshTokenUsage = TokenUsage.ReUse
},
}; …Run Code Online (Sandbox Code Playgroud) 我正在使用Laravel for VueJS前端SPA构建API.
我需要接受并返回日期为'dm-Y',而不是'Ymd',因为它存储在DB中.Data mutator工作正常,我设法在给定日期正确保存它,但是当我运行时:
$active = Announcement::where('group_id', $this->user->group_id)->where('dateTo', '>=', Carbon::today())->get();
return response()->json($active);
Run Code Online (Sandbox Code Playgroud)
我正在获取纯数据库数据,而不是格式化它.例如,我有dateTo需要格式化的字段:
public function getDateToAttribute($value)
{
$date = Carbon::createFromFormat('Y-m-d', $value);
return $date->format('d-m-Y');
}
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
我有点击列表时要编辑的元素列表.我在其他组件中有类似的解决方案,它工作得很好,但在新的一个,它不是,也找不到原因.
当组件被渲染时,我得到了:
Invalid handler for event "click": got undefined
列表:
<div v-for="annt in anns" class="item two-lines" v-if="!anntInEdit">
<div class="item-content has-secondary" v-on:click="edit(annt)">
<div>
{{ annt.title }}
</div>
<div >
{{ annt.body}}
</div>
</div>
<div class="item-secondary">
<a><i >delete</i></a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
edit (annt) {
if (this.anntInEdit == null) {
this.anntInEdit = annt
this.anntInEditBackup = Object.assign({}, this.anntInEdit)
}
this.anntInEditIndex = this.anns.indexOf(annt)
},
Run Code Online (Sandbox Code Playgroud)
当我只是点击时,我在编辑snf div中显示了表单,我可以使用save(ajax),取消(只是设置inedit为null)等但是只要我触摸编辑div中的任何输入我得到:
[Vue warn]: Invalid handler for event "click": got undefined
vue.common.js?e881:1559 Uncaught (in promise) TypeError: Cannot read property 'invoker' of …
我创建了一个简单的android活动,用作拨号。它具有电话号码的编辑文本和呼叫按钮,这是代码:(android 6.0 marshmallow)
public class Main2Activity extends AppCompatActivity {
EditText num;
Button call;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
num = (EditText) findViewById(R.id.num);
call = (Button) findViewById(R.id.call);
call.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
// request permission if not granted
if (ActivityCompat.checkSelfPermission(Main2Activity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(Main2Activity.this, new String[]{Manifest.permission.CALL_PHONE}, 123);
// i suppose that the user has granted the permission
Intent in = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + num.getText().toString()));
startActivity(in);
// if the permission is …Run Code Online (Sandbox Code Playgroud) 我有两个组成部分
组件1,名称为SearchResultVue.vue组件
该组件是这样的:
<template>
...
<span class="pull-right" v-show="totalall>8">
<pagination :data="list" :baseUrl="this.Laravel.baseUrl" :total="totalPage" :nextPage="nextPage" :prevPage="prevPage"></pagination>
</span>
...
</template>
Run Code Online (Sandbox Code Playgroud)
组件调用组件2。名称为Pagination.vue组件
分页组件是这样的:
<template>
<nav aria-label="Page navigation">
<ul class="pagination">
<li>
<a :href="prevPage" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li v-for="i in total">
<a :href="baseUrl+'/search-result?page='+i">{{i}}</a>
</li>
<li>
<a :href="nextPage" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
</template>
<script>
export default{
props:['total', 'data', 'nextPage', 'prevPage'],
computed:{
baseUrl(){
return window.Laravel.baseUrl
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
执行时,在控制台中存在2个错误
错误1是这样的:
[Vue警告]:属性或方法“ Laravel”未在实例上定义,但在渲染期间被引用。确保在data选项中声明反应性数据属性。
错误2是这样的:
未捕获的TypeError:无法读取未定义的属性'baseUrl'
我该如何解决错误?
这是我的配置:
spring.jpa:
hibernate:
ddl-auto: update
connection:
charset: utf8
useUnicode: true
properties.hibernate.dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Run Code Online (Sandbox Code Playgroud)
根据我在文档中发现的内容,因此它应该可以工作,但仍然使用 MyISAM 而不是 InnoDB 创建新表。
我的配置有什么问题?
我今天刚刚更新了我的项目(带有 VueJS 和 Quasar Framework 的 SPA),npm update但现在无法运行它。
no-duplicates Resolve error: unable to load resolver "node"我在许多不同的模块中遇到错误。它始终指向 1:1
我不知道发生了什么,因为之前一切都工作正常......
有什么建议么?
我有一个在开发环境中运行良好的应用程序,但它在生产环境中不起作用,这是由 uglify 引起的(我认为是)
我有一个用户构建的数据,我将它保存到文件或 LocalStorage(两种情况下都是 json,所以无关紧要)。
该结构由 3 种类型的节点构成。我已经在基类中实现了属性(都继承自一个类):type =this.constructor.name并且它在开发中运行良好。当我加载应用程序并读取缓存时,我会遍历 JSON 并使用switch (obj.type) case class1.name...等方法重建对象。它运行良好。
但是,当我为生产而构建时,当我调用class1.nameorclass2.name或class3.name它全部返回时e,这使得无法恢复正确的对象......
我不认为这是特定于框架的问题,但是如果有人需要知道我使用 VueJS 和 Quasar Framework 进行构建。
有任何想法吗?
javascript ×6
vue.js ×4
eslint ×2
.net-core ×1
android ×1
angularjs ×1
c# ×1
ecmascript-6 ×1
es6-class ×1
grant ×1
hibernate ×1
laravel ×1
laravel-5 ×1
laravel-5.3 ×1
node.js ×1
npm ×1
npm-scripts ×1
pagination ×1
permissions ×1
php ×1
runtime ×1
spring ×1
spring-boot ×1
uglifyjs ×1
vuejs2 ×1
webpack ×1