angularjs vue

Front-end frameworks like AngularJS allow us to build out very nice single page applications easily, especially when we become well versed with all the concepts.

像AngularJS这样的前端框架使我们能够轻松构建非常漂亮的单页应用程序,尤其是当我们对所有概念都精通的时候。

However, for many projects, frameworks like Angular can actually be a little bit more than what we need.

但是,对于许多项目,像Angular这样的框架实际上可能比我们需要的多一点。

If all we want to do is implement a few features a single page application, it's can be a bit much to setup the necessary config, routing, controllers, services and more that make up an Angular app.

如果我们要做的就是在单个页面应用程序中实现一些功能,那么设置一些必要的配置,路由,控制器,服务以及构成Angular应用程序的其他内容可能会有点麻烦。

For something more lightweight, a great solution is Vue.js. Vue is a library that focuses heavily on the ViewModel---the two-way data bindings that tie what we see and interact with on the screen with the application's data model. In this way (and as stated on the Vue.js website), the library is "not a full-blown framework - it is designed to be a view layer that is simple and flexible".

对于更轻量的东西,Vue.js是一个很好的解决方案。 Vue是一个专注于ViewModel的库-双向数据绑定将我们在屏幕上看到的内容和与应用程序的数据模型进行交互的内容绑定在一起。 通过这种方式(如Vue.js网站上所述),该库“不是一个成熟的框架-它被设计为简单而灵活的视图层”。

For many use cases this is awesome because it means we can get the benefits of a single page(ish) application without the overhead that can come with using larger frameworks.

对于许多用例来说,这是非常棒的,因为这意味着我们可以获得单页(ish)应用程序的好处,而无需使用较大的框架而会产生额外的开销。

In this tutorial we will be building a simple events bulletin board application that will allow users to add and remove events. To explore Vue's main features we will simply be working with local data on the client side, but towards the end we'll see how we can use the vue-resource package to send HTTP requests to a back end.

在本教程中,我们将构建一个简单的事件公告板应用程序,该应用程序将允许用户添加和删除事件。 为了探索Vue的主要功能,我们将只在客户端使用本地数据,但是到最后,我们将看到如何使用vue-resource包将HTTP请求发送到后端。

build-an-events-app-with-vue-js

与AngularJS的相似之处 (Similarities to AngularJS)

If you're familiar with AngularJS, you'll likely notice a lot of similarities between it and Vue.js as we go. Vue is heavily influenced by Angular and this actually works to our benefit because concepts transfer nicely between the two.

如果您熟悉AngularJS,那么我们可能会注意到它与Vue.js之间的许多相似之处。 Vue受Angular的影响很大,这实际上对我们有利,因为概念在两者之间可以很好地传递。

安装依赖项 (Installing the Dependencies)

Let's first grab Vue.js, Vue Resource, and Bootstrap with npm. From the command line:

首先让我们使用npm来获取Vue.js,Vue资源和Bootstrap。 在命令行中:

npm install vue vue-resource bootstrap

We'll also need to create the main files:

我们还需要创建主文件:

touch index.html app.js

设置HTML (Setting Up the HTML)

<!-- index.html --><!doctype html>
<html>
<head><meta charset="utf-8"><title>Vue</title><!-- CSS --><link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body><!-- navigation bar --><nav class="navbar navbar-default"><div class="container-fluid"><a class="navbar-brand"><i class="glyphicon glyphicon-bullhorn"></i> Vue Events Bulletin Board</a></div></nav><!-- main body of our application --><div class="container" id="events"><!-- add an event form --><div class="col-sm-6"><div class="panel panel-default"><div class="panel-heading"><h3>Add an Event</h3></div><div class="panel-body"></div></div></div><!-- show the events --><div class="col-sm-6"><div class="list-group"></div></div></div><!-- JS --><script src="node_modules/vue/dist/vue.js"></script><script src="node_modules/vue-resource/dist/vue-resource.js"></script><script src="app.js"></script>
</body>
</html>

The main <div> with an ID of events is our target area for the application. As we'll see in the next section, we need to create a Vue instance for each part of the application that we want to target.

具有events ID的主<div>是我们应用程序的目标区域。 正如我们将在下一节中看到的那样,我们需要为要定位的应用程序的每个部分创建一个Vue实例。

In Angular, we can limit our application modules to certain parts of the HTML with ng-app="{module}". Vue works in a similar way. When we set up the Vue instance, we define an element to target and anything within that element will be available to the application.

在Angular中,我们可以使用ng-app="{module}"将应用程序模块限制为HTML的某些部分。 Vue的工作方式与此类似。 当我们设置Vue实例时,我们定义了一个要定位的元素,并且该元素中的所有内容都可供应用程序使用。

创建Vue实例 (Creating a Vue Instance)

Within app.js, let's setup a new Vue instance and target theeventssection of the HTML by setting it on the el key.

app.js ,让我们设置一个新的Vue实例,并通过将其设置在elapp.js定位HTML的events部分。

// app.jsnew Vue({
// We want to target the div with an id of 'events'el: '#events'
});

At this point, Vue is available anywhere within div#events. Before setting up the rest of the HTML, let's setup the other keys that we'll need for our Vue instance and cover what they are responsible for.

此时,Vue在div#events任何位置都可用。 在设置其余HTML之前,让我们设置Vue实例所需的其他键,并介绍它们的作用。

// app.jsnew Vue({// We want to target the div with an id of 'events'el: '#events',// Here we can register any values or collections that hold data// for the applicationdata: {},// Anything within the ready function will run when the application loadsready: function() {},// Methods we want to use in our application are registered heremethods: {}
});
  • The data key will be the object where all our ViewModel data is registered

    data键将是注册所有ViewModel数据的对象
  • The ready function will run when the application loads and is useful for calling other methods to initialize the app with data

    ready函数将在应用程序加载时运行,这对于调用其他方法以使用数据初始化应用程序很有用
  • The methods key is where we can register custom methods for the application

    methods键是我们可以为应用程序注册自定义方法的位置

添加表格 (Adding the Form)

Our form will need inputs for the event details. We'll use the native HTML5 datepicker for selecting the event date. NOTE: This will not work in Firefox.

我们的表格将需要输入事件详细信息。 我们将使用本地datepicker注意:这在Firefox中不起作用。

<!-- index.html -->...<div class="panel-heading"><h3>Add an Event</h3>
</div>
<div class="panel-body"><div class="form-group"><input class="form-control" placeholder="Event Name" v-model="event.name"></div><div class="form-group"><textarea class="form-control" placeholder="Event Description" v-model="event.description"></textarea></div><div class="form-group"><input type="date" class="form-control" placeholder="Date" v-model="event.date"></div><button class="btn btn-primary" v-on="click: addEvent">Submit</button></div>...

You'll notice that we're adding a directive called v-model to our input and textarea elements and we're assigning distinct spots on an event object to each. Just like with ng-model in Angular, the values that we type into these fields will be bound to the ViewModel and will be available for use elsewhere in the application.

您会注意到,我们在inputtextarea元素中添加了一个称为v-model的指令,并且在event对象上为每个对象分配了不同的位置。 就像Angular中的ng-model一样,我们在这些字段中键入的值将绑定到ViewModel并将在应用程序的其他地方使用。

The submit button element has the v-on directive with a value of "click: addEvent" on it. This works much the same way that ng-click does with Angular: we pass a method to be run on the click event. The difference that Vue introduces is that we can use the v-on directive to specify the type of event we want the element to respond to. For example, we could say v-on="keyup: addEvent" and the addEvent method would be called when a keystroke is finished.

提交按钮元素具有v-on指令,其上的值为"click: addEvent" 。 这与ng-click对Angular的工作方式几乎相同:我们传递了一种在click事件上运行的方法。 Vue引入的区别是我们可以使用v-on指令来指定我们希望元素响应的事件的类型。 例如,我们可以说v-on="keyup: addEvent" ,当击键完成时将调用addEvent方法。

If we view the app in the browser, we see that we get our form:

如果我们在浏览器中查看该应用程序,就会看到我们得到了表格:

vue-1-1

添加事件数据 (Adding Event Data)

The addEvent method we added to the click event in the last section is obviously going to be responsible for adding new events in. We'll add this method in now and also prime the application with some data.

我们在上一节中添加到click事件的addEvent方法显然将负责添加新事件。我们现在将添加此方法,并使用一些数据来填充应用程序。

// app.js...data: {event: { name: '', description: '', date: '' },events: []
},// Anything within the ready function will run when the application loads
ready: function() {// When the application loads, we want to call the method that initializes// some datathis.fetchEvents();
},// Methods we want to use in our application are registered here
methods: {// We dedicate a method to retrieving and setting some datafetchEvents: function() {var events = [{id: 1,name: 'TIFF',description: 'Toronto International Film Festival',date: '2015-09-10'},{id: 2,name: 'The Martian Premiere',description: 'The Martian comes to theatres.',date: '2015-10-02'},{id: 3,name: 'SXSW',description: 'Music, film and interactive festival in Austin, TX.',date: '2016-03-11'}];// $set is a convenience method provided by Vue that is similar to pushing// data onto an arraythis.$set('events', events);},// Adds an event to the existing events arrayaddEvent: function() {if(this.event.name) {this.events.push(this.event);this.event = { name: '', description: '', date: '' };}}
}
...

On the data key, we are registering both the event object that will hold our form data, as well as an empty events array that will be populated with data when the application loads. If we didn't pre-initialize the event object by registering it on the data key, we would still get values from our form as expected. However, by initializing it we get "more reliable reactivity and better performance" as a warning message in the console reveals.

data键上,我们既注册了将保存表单数据的event对象,又注册了将在应用程序加载时填充数据的空events数组。 如果我们没有通过将event对象注册到data键上来对其进行预初始化,那么我们仍将按预期从表单中获取值。 但是,通过对其进行初始化,控制台中的警告消息显示出“更可靠的React性和更好的性能”。

Within the ready function we are calling fetchEvents which is a method that takes some data and uses Vue's $set to put it onto the events array. The $set method is provided by Vue and when used to put data onto an array, triggers a view update. Its first argument needs to be a string with the name of the keypath that we want to target.

ready函数中,我们正在调用fetchEvents ,它是一种获取一些数据并使用Vue的$set将其放入events数组的方法。 $set方法由Vue提供,当用于将数据放入数组时,将触发视图更新。 它的第一个参数必须是一个带有我们要定位的键路径名称的字符串。

Finally, the addEvent method first checks to make sure we at least have a value present for event.name and if so, pushes the event onto the the events array. After this, the form is cleared by setting the event object keys back to empty strings. We're ready to view existing listings and add new ones, but we'll need some HTML to display them.

最后, addEvent方法首先检查以确保我们至少有一个event.name值,如果存在, event.name事件推送到events数组。 此后,通过将event对象键设置回空字符串来清除表单。 我们已经准备好查看现有列表并添加新列表,但是我们需要一些HTML来显示它们。

添加列表区域 (Adding the Listing Area)

To list out the events, we'll need HTML in which we will include some templating.

要列出事件,我们需要HTML,其中将包含一些模板。

<!-- index.html -->...<div class="list-group"><a href="#" class="list-group-item" v-repeat="event in events"><h4 class="list-group-item-heading"><i class="glyphicon glyphicon-bullhorn"></i> {{ event.name }}</h4><h5><i class="glyphicon glyphicon-calendar" v-if="event.date"></i> {{ event.date }}</h5><p class="list-group-item-text" v-if="event.description">{{ event.description }}</p><button class="btn btn-xs btn-danger" v-on="click: deleteEvent($index)">Delete</button></a></div>...

As you can see, we're using Vue's v-repeat on the a tag to loop over the events data. As you're probably thinking, v-repeat works just like Angular's ng-repeat. Templating works the same way as it does in Angular as well---we use the double curly braces to render data. In this case, we access the name, date, and description values within various elements to display the events data.

正如你所看到的,我们使用Vue公司的v-repeata在事件数据标签循环。 正如您可能在想的那样, v-repeat工作原理与Angular的ng-repeat 。 模板的工作方式与Angular中的工作方式相同-我们使用双花括号来呈现数据。 在这种情况下,我们将在各个元素中访问namedatedescription值以显示事件数据。

The button at the bottom triggers a click event that calls deleteEvent, which we have yet to create. This method accepts Vue's $index property as an argument. This property gives us the index of the current element within the v-repeat loop and will be used to remove that element once we setup the deleteEvent method.

底部的button触发一个单击事件,该事件调用deleteEvent ,我们尚未创建。 此方法接受Vue的$index属性作为参数。 此属性为我们提供了v-repeat循环中当前元素的索引,并且在设置deleteEvent方法后将用于删除该元素。

If we refresh the page, we see that we get the events data displayed and that we can also add in new events.

如果刷新页面,则会看到显示的事件数据,也可以添加新事件。

vue-1-2

vue-1-3

We've already got the button for deleting events set up, lets now create the method that should be called when it is clicked.

我们已经设置了用于删除事件的button ,现在让我们创建单击该事件时应调用的方法。

// app.js...deleteEvent: function(index) {if(confirm("Are you sure you want to delete this event?")) {// $remove is a Vue convenience method similar to splicethis.events.$remove(index);        }
}...

In this method we are first prompting the user to confirm that they actually want to delete the event. If they click "OK", the event is removed by using Vue's $remove convenience method which takes care of finding the index passed in from the view and removing the element from the DOM.

在这种方法中,我们首先提示用户确认他们确实要删除事件。 如果他们单击“确定”,则使用Vue的$remove便捷方法$remove该事件,该方法负责查找从视图传入的索引并从DOM中删除元素。

切换到后端 (Switching to a Back End)

Like AngularJS, Vue is totally agnostic about the back end that we use for our applications. Just as long as the server responds to HTTP requests with JSON, we can use Vue Resource to handle data retrieval.

像AngularJS一样,Vue完全不了解我们用于应用程序的后端。 只要服务器使用JSON响应HTTP请求,我们就可以使用Vue Resource来处理数据检索。

As previously mentioned, we won't actually set up a back end in this tutorial, but we will show how to make the appropriate HTTP requests to one. A NodeJS back end would be an easy solution for a Vue app, and you can learn how to set one up with Scotch.io's Mean Machine eBook (you'll just need to swap out the Angular stuff for Vue).

如前所述,我们实际上不会在本教程中设置后端,但是我们将展示如何向一个后端发出适当的HTTP请求。 对于Vue应用程序, NodeJS后端将是一个简单的解决方案,您可以学习如何使用Scotch.io的Mean Machine电子书进行设置 (您只需要将Angular内容换成Vue)即可​​。

The first step would be to move the events data over to the server and set up an endpoint which would take care of serving the events. Ideally we would have an endpoint that would respond to a GET request at something like api/events. We would then change our fetchEvents method up to send the request:

第一步是将事件数据移到服务器上,并设置一个负责处理事件的端点。 理想情况下,我们将拥有一个在api/events类的响应GET请求的端点。 然后,我们将更改fetchEvents方法以发送请求:

// app.js...// If we had a back end with an events endpoint set up that responds to GET requests
this.$http.get('api/events').success(function(events) {this.$set('events', events);
}).error(function(error) {console.log(error);
});...

In the success handler of the GET request we are still using $set to put the returned data onto the events array. We could also make POST requests to add data:

GET请求的成功处理程序中,我们仍在使用$set将返回的数据放入events数组。 我们还可以发出POST请求以添加数据:

// app.js...// If we had an endpoint set up that responds to POST requests
this.$http.post('api/events', this.event).success(function(response) {this.events.push(this.event);console.log("Event added!");
}).error(function(error) {console.log(error);
});...

In this case we are sending the event object that contains the form data by including it as the second argument to the call. In the success handler, we are pushing the event onto the array to update the view, much like we were before.

在这种情况下,我们通过将其包含为调用的第二个参数来发送包含表单数据的event对象。 在成功处理程序中,我们将事件推送到数组上以更新视图,就像以前一样。

Another way we could update the view is by making an additional GET request to retrieve the total list in the success handler, but this requires another network request which isn't ideal. Deleting an event is simple as well.

我们可以更新视图的另一种方法是通过发出另一个GET请求来检索成功处理程序中的总列表,但这需要另一个不理想的网络请求。 删除事件也很简单。

// app.js...// We could also delete an event if we had the events endpoint set up to delete data
this.$http.delete('api/events/' + event.id).success(function(response) {this.events.$remove(index);
}).error(function(error) {console.log(error);
});...

In this case we are tacking the event.id onto the end of the route for our DELETE request which, if our API is setup to do it, will delete the record based on that ID. For this to work we would need to pass event into the method call from the view and then receive it on the deleteEvent method.

在这种情况下,我们会将event.id附加到DELETE请求的路由末尾,如果设置了我们的API,则DELETE请求将根据该ID删除记录。 为此,我们需要将event从视图传递到方法调用中,然后在deleteEvent方法上接收它。

结语 (Wrapping Up)

Vue.js offers us a great alternative to larger frameworks like AngularJS and is a perfect solution for cases in which we want to easily create single page apps without a lot of overhead. The library is flexible and easy to work with and if you have experience with Angular, you'll feel right at home.

Vue.js为我们提供了替代AngularJS之类的较大框架的绝佳选择,并且是我们想要轻松创建单页面应用程序而又没有太多开销的情况的完美解决方案。 该库非常灵活,易于使用,如果您有使用Angular的经验,就会感到宾至如归。

To build a full-fledged single page application with Vue, we can use vue-router which integrates with the Vue.js core to handle routing.

要使用Vue构建完整的单页应用程序,我们可以使用与Vue.js核心集成的vue-router来处理路由。

给我留言 (Drop Me a Line)

If you’d like to get more tutorials like this one, feel free to head over to my website and signup for my mailing list. You should follow me on Twitter---I'd love to hear about what you're working on!

如果您想获得更多类似的教程,请随时访问我的网站并注册我的邮件列表 。 您应该在Twitter上关注我---我很想知道您在做什么!

翻译自: https://scotch.io/tutorials/build-an-app-with-vue-js-a-lightweight-alternative-to-angularjs

angularjs vue

查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. Vue学习篇(十四)—路由

    Vue Day 14——vue-router路由详解 概述 认识路由vue-router基本使用vue-router嵌套路由 14.1. 认识路由 什么是路由&#xff1f; 说起路由你想起了什么&#xff1f; 路由是一个网络工程里面的术语。 路由&#xff08;routing&#xff09;就是通过互联的网络把信息从源地址…...

    2024/4/23 13:49:01
  2. 2-Vue 的实现

    1.声明式渲染 DOM应尽可能是一个函数式到状态的映射。 DOM状态只是数据状态的一个映射。 如图所示&#xff0c;所有的逻辑尽可能在状态的层面去进行 当状态改变时&#xff0c;View应该是在框架帮助下自动更新到合理的状态&#xff0c;而不是当你观测到数据变化之后手动选择一…...

    2024/5/5 14:43:02
  3. 深入浅出学 Vue 开发

    课程介绍 前端技术日新月异&#xff0c;每一种新的思想出现&#xff0c;都代表了一种技术的跃进、架构的变化&#xff0c;那么对于目前的前端技术而言&#xff0c;MVVM 的思想已经可以代表当今前端领域的前沿思想理念&#xff0c;Angular、React、Vue 等基于 MVVM 思想的具体实…...

    2024/4/21 4:41:54
  4. vue-router两种模式

    说起vue-rouer&#xff0c;不得不提的一个概念是前端路由&#xff0c;要想深入理解前端路由&#xff0c;不得不了解路由、后端路由、前端路由和后端路由的区别、多页面应用、单页面应用这些概念。 一、捋一捋概念呀先 1、单页面应用与多页面应用 单页面应用&#xff08;SPA&…...

    2024/4/21 4:41:51
  5. Vue Router详细教程

    Vue Router 1.什么是路由 1.1路由简介 说起路由你想起了什么&#xff1f;路由是一个网络工程里面的术语。 路由&#xff08;routing&#xff09;就是通过互联的网络把信息从源地址传输到目的地址的活动。 — 维基百科 额&#xff0c;啥玩意? 没听懂。在生活中&#xff0c;我…...

    2024/4/30 11:38:26
  6. vue项目SEO优化

    技术笔记 欢迎大家进群&#xff0c;一起探讨学习 微信公众号&#xff0c;每天给大家提供技术干货 博主技术平台地址 博主开源微服架构前后端分离技术博客项目源码地址&#xff0c;欢迎各位star 前言 单页应用&#xff08;SPA&#xff09;是最近流行的一种应用模式&#xff0c…...

    2024/5/6 17:02:48
  7. vue-router

    vue-router 路由 路由是一个网络工程里面的术语。 路由&#xff08;routing&#xff09;就是通过互联的网络把信息从源地址传输到目的地址的活动. 路由器提供了两种机制: 路由和转送. 路由是决定数据包从来源到目的地的路径. 转送将输入端的数据转移到合适的输出端. 路由…...

    2024/5/1 14:07:22
  8. Vue 一套构建用户界面的渐进式的框架 (路由篇~)

    此块知识内容基础&#xff0c;没有官方文档全&#xff0c;仅供参考概述&#xff08;了解&#xff09; 单页面富用阶段&#xff08;SPA&#xff09;SPA 主要的特点是在前后端分离&#xff08;后端只提供API来返回数据&#xff0c;前端通过Ajax获取到的数据渲染到页面&#xff0…...

    2024/5/6 12:44:24
  9. vue-router 路由的认识

    1&#xff1a; vue-router&#xff1a;的基本使用 2&#xff1a; vue-router: 的嵌套使用 3&#xff1a; vue-router: 的参数传递 4&#xff1a;vue-router: 的导航守卫 5&#xff1a; keep-alive 前端路由的核心就是&#xff1a; 改变url 的时候&#xff0c; 但是整个…...

    2024/5/6 16:01:33
  10. vue2x

    教程 基础 安装 兼容性 Vue 不支持 IE8 及以下版本&#xff0c;因为 Vue 使用了 IE8 无法模拟的 ECMAScript 5 特性。但它支持所有兼容 ECMAScript 5 的浏览器。 更新日志 最新稳定版本&#xff1a;2.5.13 每个版本的更新日志见 GitHub。 Vue Devtools 在使用 Vue 时&#xff0…...

    2024/4/20 19:44:50
  11. vue router带参数页面刷新或者回退参数消失的解决方法

    start 写在前面&#xff1a; 传参是前端经常需要用的一个操作&#xff0c;很多场景都会需要用到上个页面的参数&#xff0c;本文将会详细介绍vue router 是如何进行传参的&#xff0c;以及一些小细节问题。有需要的朋友可以做一下参考&#xff0c;喜欢的可以点波赞&#xff0c;…...

    2024/5/6 8:16:30
  12. 路由的认识(后端、前端、vue-router)

    1.路由是一个网络工程中的术语 2.路由(routing)就是通过互联的网络把信息从源地址传输到目的地址的活动---维基百科 3.路由器提供了两种机制&#xff1a;路由和转送 路由&#xff1a;决定数据包从来源到目的地的路径 转送&#xff1a;将输入端的数据转移到合适的输出…...

    2024/4/20 19:44:48
  13. react.lazy 路由懒加载_Vuerouter(路由)

    Vue-router(路由)01一、什么是路由&#xff1f;说起路由你想起了什么&#xff1f;路由器&#xff0c;那路由器是用来做什么的&#xff0c;你有没有想过&#xff1f;- 路由时决定数据包从来源到目的地的路径&#xff1b;- 将输入端的数据转移到合映射表适的输出端&#xff1b;- …...

    2024/4/20 19:44:47
  14. 【Vue.js 知识量化】vue-router 详解

    vue-router 详解认识路由后端路由&#xff08;了解&#xff09;前端路由URL 的 hashHTML5 的 history 模式&#xff08;5 种&#xff09;vue-router安装和使用 vue-router路由的默认路径HTML5 的 History 模式路由懒加载嵌套路由嵌套路由默认路径路由传递参数$route 获取参数导…...

    2024/4/20 17:03:37
  15. Vue2.x核心总结

    titel:Vue 核心 Vue 核心 一、Vue 的基本认识 渐进式 JavaScript 框架&#xff0c;用来动态构建用户界面 特点 遵循 MVVM 模式 编码简洁&#xff0c;体积小&#xff0c;运行效率高&#xff0c;适合 移动/pc 端开发它本身只关注 UI&#xff0c;可以轻松引入 vue 插件或其它第…...

    2024/4/20 19:44:45
  16. 解决vue多个路由共用一个页面的问题

    本次为大家分享一篇解决vue多个路由共用一个页面的问题&#xff0c;写的十分的全面细致&#xff0c;具有一定的参考价值&#xff0c;对此有需要的朋友可以参考学习下。如有不足之处&#xff0c;欢迎批评指正。 在日常的vue开发中我们可能会遇见多个路由需要共用一个页面的需求&…...

    2024/4/21 4:41:47
  17. 为Angular(2+)开发人员提供带TypeScript的Vue.js

    目录 介绍 单页应用程序的演变&#xff08;SPA&#xff09; 三大框架概述 Angular开发者的Vue.js 学习Vue.js Vue.js页面的剖析 构建示例应用程序 TypeScript的案例 入门——Vue.js CLI 3.0 Vuetify和Material Design 开始和运行 主Vue.js TypeScript页面 装饰器和…...

    2024/4/21 4:41:46
  18. Vue-Router 前端路由

    1. 概述 路由是一个网络工程里面的术语路由就是通过互联的网络把信息从源地址传输到目的地址的活动后端路由&#xff1a;后端处理URL和页面之间的映射关系前端路由&#xff1a;前端处理URL和页面之间的映射关系 2. 后端路由阶段 早期的网站开发整个HTML页面是由服务器来渲染的…...

    2024/4/21 4:41:45
  19. 市南区双眼皮哪家真实

    ...

    2024/4/21 4:41:45
  20. [Angular实战网易云]——27、HTTP拦截器

    HTTP拦截 在做请求的时&#xff0c;有时需要对请求做一些配置上的附加或者改变&#xff0c;又或者是对响应值的拦截&#xff0c;这时候就需要拦截器了。 场景 签到时需要登录状态&#xff0c;而状态值存在cookies中&#xff0c;所以在每次请求时都需要将cookies一起发送过去…...

    2024/4/21 4:41:44

最新文章

  1. 介绍一下std::thread

    std::thread 是 C11 标准库中的一个类&#xff0c;它用于表示和控制线程的执行。通过 std::thread&#xff0c;你可以创建和管理多个并发执行的线程&#xff0c;这些线程可以共享应用程序的资源&#xff0c;并执行不同的任务。 创建线程 std::thread 的构造函数用于创建线程。…...

    2024/5/6 18:37:13
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/5/6 9:38:23
  3. app上架-您的应用存在最近任务列表隐藏风险活动的行为,不符合华为应用市场审核标准。

    上架提示 您的应用存在最近任务列表隐藏风险活动的行为&#xff0c;不符合华为应用市场审核标准。 修改建议&#xff1a;请参考测试结果进行修改。 请参考《审核指南》第2.19相关审核要求&#xff1a;https://developer.huawei.com/consumer/cn/doc/app/50104-02 造成原因 …...

    2024/5/5 6:14:32
  4. 【虚幻引擎】C++ slate全流程开发教程

    本套课程介绍了使用我们的虚幻C去开发我们的编辑器&#xff0c;扩展我们的编辑器&#xff0c;设置我们自定义样式&#xff0c;Slate架构设计&#xff0c;自定义我们的编辑器样式&#xff0c;从基础的Slate控件到我们的布局&#xff0c;一步步的讲解我们的的Slate基础知识&#…...

    2024/5/6 9:46:04
  5. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/5/4 23:54:56
  6. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/5/4 23:54:56
  7. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/5/4 23:54:56
  8. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/5/6 9:21:00
  9. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/5/4 23:54:56
  10. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/5/4 23:55:05
  11. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/5/4 23:54:56
  12. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/5/4 23:55:16
  13. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/5/4 23:54:56
  14. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/5/6 1:40:42
  15. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/5/4 23:54:56
  16. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/5/4 23:55:17
  17. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/5/4 23:55:06
  18. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/5/4 23:54:56
  19. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/5/4 23:55:06
  20. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/5/5 8:13:33
  21. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/5/4 23:55:16
  22. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/5/4 23:54:58
  23. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/5/4 23:55:01
  24. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/5/4 23:54:56
  25. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  26. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  27. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  28. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  29. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  30. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  31. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  32. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  33. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  34. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  35. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  36. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  37. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  38. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  39. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  40. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  41. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  42. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  43. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  44. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57