摘要: 1、组件创建及使用 (1)在 components 目录下,新建 Learn.vue 文件,示例代码如下: <template> <!-- 只能存在一个根容器 --> <div class="container"> <p>hello world</p> </div> </template> <scr 阅读全文
posted @ 2020-03-24 20:30 d0usr 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 1、基本用法 Vue 提供了 v-model 指令,用于在表单类元素上双向绑定数据,例如在输入框上使用时,输入的内容会实时映射到绑定的数据上。例如下面的例子: <template> <div id="app"> <input type="text" v-model="message" placeho 阅读全文
posted @ 2020-03-24 20:06 d0usr 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 在数据绑定中,最常见的两个需求就是元素的样式名称 class 和 内联样式 style 的动态绑定,它们也是 html 的属性,因此可以使用 v-bind 指令。 1、绑定 class 的几种方式 (1)对象语法: 给 v-bind:class 设置一个对象,可以动态的切换 class,例如: <t 阅读全文
posted @ 2020-03-24 18:40 d0usr 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 1、computed 选项: <template> <div id="app"> {{ reversedText }} </div> </template> <script> export default { name: "App", data() { return { text: '123,456 阅读全文
posted @ 2020-03-24 18:26 d0usr 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 1、v-on 指令类似原生 Javascript 的 onclick 等写法,也是在 html 上进行监听的。例如: <template> <div id="app"> 点击次数:{{ counter }} <button @click="counter++">+1</button> </div> 阅读全文
posted @ 2020-03-24 18:21 d0usr 阅读(458) 评论(0) 推荐(0) 编辑
摘要: 1、模板语法: 使用双大括号(Mustache 语法) “{{ }}” 是最基本的文本插值方法,它会自动将我们双向绑定的数据实时显示出来。例如: <template> <div id="app"> <p>{{ msg }}</p> <p>{{ 20+1 }}</p> <p>{{ "ok" ? 'ye 阅读全文
posted @ 2020-03-24 18:15 d0usr 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 1、初始化 Vue 项目: (1)彻底删除 cnpm (假如已安装过): npm uninstall cnpm -g (2)安装 cnpm 淘宝的包管理器(由于 npm 的插件都是从国外服务器下载,因网络不稳定,可能出现异常,所以需要更换为 cnpm): npm install cnpm -g -- 阅读全文
posted @ 2020-03-23 16:20 d0usr 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 1、搭建 zookpeer 注册中心: 下载地址:https://zookeeper.apache.org/releases.html (1)解压下载的 tar.gz 包(版本为 zookpeer-3.4.14版本): (2)创建 data 目录,用于保存 zookpeer 的数据及日志: (3)在 阅读全文
posted @ 2020-03-20 20:58 d0usr 阅读(1256) 评论(0) 推荐(0) 编辑
摘要: 1、应用场景: 当存在多个域名时,如果所有配置都写在 nginx.conf 主配置文件中,难免会显得杂乱与臃肿。 为了方便配置文件的维护,所以需要进行拆分配置。 2、在 nginx 的 conf 目录下 创建 vhost 文件夹: [root@Centos conf]# pwd /usr/local 阅读全文
posted @ 2020-03-13 18:17 d0usr 阅读(29877) 评论(0) 推荐(3) 编辑
摘要: 1、alias 配置: location /resources/image/ { alias /local_path/image/; }# 访问:http://127.0.0.1/resources/image/test.png# 定位资源路径为:/local_path/image/test.png 阅读全文
posted @ 2020-03-13 17:04 d0usr 阅读(230) 评论(0) 推荐(0) 编辑