require

vue项目

蹲街弑〆低调 提交于 2019-12-04 16:26:42
vue项目 一、uve目录结构 1.1 node_modules ​ npm 加载的项目依赖模块。 1.2 public ​ 可以放置静态资源,任何放置在 public 文件夹的静态资源都会被简单的复制,而不经过 webpack。你需要通过绝对路径来引用它们。 1.3 src ​ 这是开发使用的目录,几乎所有的操作都在这里进行。 ​ assets: 放置一些图片,如logo等。 ​ components: 目录里面放置组件文件 ​ App.vue: 项目入口文件,也可以将组件写在这里 ​ main.js: 项目的核心文件 1.4 package.json ​ 项目配置文件。 1.5 README.md ​ 项目的说明文档,markdown 格式 二、文件的具体配置(图书系统为例) 2.1 main.js ​ 1.入口文件:加载vue、router、store等配置 以及 加载自定义配置(自己的js、css,第三方的js、css) 。 ​ 2.创建项目唯一根组件,渲染App.vue,挂载到index.html中的挂载点 => 项目页面显示的就是 App.vue 组件 。 ​ 3.在App.vue中设置页面组件占位符 。 ​ 4.浏览器带着指定 url链接 访问vue项目服务器,router组件就会根据 请求路径 匹配 映射组件,去替换App.vue中设置页面组件占位符。 ​ eg:

@RendSection{\"scripts\",require:false}的作用

无人久伴 提交于 2019-12-04 16:20:46
MVC视图中,Javascripts代码被放于下面的Razor代码中(@section Scripts{})。 好处:在视图进行JavaScript编程时,是一个很好的实践,在共享视图(_Layout.cshtml),存在节点(@RenderSection("scripts", required: false)),在视图执行时,Razor引擎会将Javascripts代码 抽调 出来,然后在执行的时候,再将这些代码放置在这个地方。 控制器下的代码如下: The name is <span data-bind="text: Name"></span> @section Scripts{ <script> function ViewModel() { this.Name = ""; } var viewModel = new ViewModel(); ko.applyBindings(viewModel); </script> } 布局视图_layout.cshtml代码如下: <body> <div class="container body-content"> @RenderBody() </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") <script src="~

Vue.js学习笔记1

倾然丶 夕夏残阳落幕 提交于 2019-12-04 16:05:55
Vue.js 是一个MVVM的架构 视图View中数据发生变化,观察者会改动Model中JS的数据;反之亦然。 实现了数据的双向绑定。 是为了避免经常刷新整个网页资源而应运而生的(主要用ajax交互) 数据驱动 即是只要JS的数据改变,Vue.js观察者的Directives就会发现,并且 自动让DOM中的数据跟着改变 。如下图。 该图的红色是从 右到左 传递的。 同样,view中的数据改变了,Vue.js也能够让Model中的JS对象 自动跟着转变 。 该图的红色是从 左到右 传递的。 具体的原理如下。 从 数据改变 到 更新视图 的过程: 有一个watcher在观察Model中的a.b对象,只要在JS中调用了a.b,都会在View中用v-text更新一个a.b的值。 Vue.js的介绍到此结束。 Vue CLI CLI中启动的方式: 1. 打开命令行CLI(node.js的或者cmd等都可以) 2. cd到当前vue项目的主文件夹(即包含有package.json的根目录) 3. 执行 npm run dev 即可,启动当前vue项目在node.js上运行(配置相关内容在config/index.js)。 文件结构分析 文件夹 build和config都是webpack配置相关 node_modules是通过npm install安装的依赖代码库 src是存放源码目录

Node 之 Express 4x 骨架详解

风流意气都作罢 提交于 2019-12-04 15:38:45
周末,没事就来公司加班继续研究一下Express ,这也许也是单身狗的生活吧。 1、目录结构: bin, 存放启动项目的脚本文件 node_modules, 项目所有依赖的库,以及存放 package.json 中安装的模块,当你在 package.json 添加依赖的模块并安装后,存放在这个文件夹下 public,静态文件(css,js,img) routes,路由文件(MVC中的C,controller) views,页面文件(jade模板),后期打算换成 Ejs 模板搞搞 package.json,存储着工程的信息及模块依赖 app.js,应用核心配置文件(入口文件) 2、Package.json package.json用于项目依赖配置及开发者信息,scripts属性是用于定义操作命令的,可以非常方便的增加启动命令,比如默认的start,用npm start代表执行node ./bin/www命令。当在 dependencies 中添加依赖的模块时,运行 npm install ,npm 会检查当前目录下的 package.json,并自动安装所有指定的模块。 { "name": "myapp", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" },

作业 : include , include_once , require , require_once 区别

泄露秘密 提交于 2019-12-04 13:35:26
include():会执行括号内文件的程序; include_once():只能执行一个不重复的文件,就是说括号内的文件在页面里只能执行一次, require():会将括号内的内容读入,并将自己本身替换成这些读入的内容; require_once():区别与include和include_once的区别一样,号内的文件在页面里只能执行一次, include与require的区别:include执行的时候,如果括号内的文件不存在,但下方还有其他代码,会报错并且继续往下执行。 反之require,当她没有检测到包含文件的时候会直接停止运行 include和require还有一个区别是如果一串代码有十个include(XX.php),那么他就会查询十次,而require写100次,也只查询一次,所以require比include的执行速度快. 来源: https://www.cnblogs.com/-lilin/p/11868082.html

file_exists() or is_readable()

余生颓废 提交于 2019-12-04 09:55:51
问题 Which one should you use when you want to include a PHP file? if(file_exists($file) require "$file"; or if(is_readable($file) require "$file"; ? 回答1: file_exists() or is_readable() Which one should you use when you want to include a PHP file? This depends on if you want to know if only a file or a directory exists, or if either is fine, and if you need to check if readable or not. Sometimes you only care the file and/or directory exist, and don't need to read, sometimes you also need to read.

vue的三种图片引入方式

家住魔仙堡 提交于 2019-12-04 09:36:20
vue的三种图片引入方式 首先给图片地址绑定变量: <template> <img :src="imgUrl"> </template> 在script中设置变量: //方法1:直接将图片引入为模块 require imgUrl from "../assets/test.png" //方法2:把imgUrl放在数据中 data() { return { imgUrl:require("../assets/test.png") } } 补充方法2:(在data数组中保存数据的情况) data() { test: [ { imgUrl: require('../assets/test.png'), id: '1' }, ], ... } //方法3:在生命周期函数中设置 data() { return { imgUrl:" " } } created() { let urlTemp = "assets/test.png"; this.imgUrl = require("@/" + urlTemp) } </script> 来源: https://www.cnblogs.com/yihangjou/p/11854155.html

php 环境require(): open_basedir restriction in effect 错误

*爱你&永不变心* 提交于 2019-12-04 09:27:54
php 环境require(): open_basedir restriction in effect 错误 错误日志显示,访问脚本不在 open_basedir的限定目录里面 解决方法 打开fastcgi.conf 设置如下 fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/data/web/"; ps:/data/web改成项目路径 这样就没有限制了 来源: https://www.cnblogs.com/newmiracle/p/11853355.html

multer实现图片上传

徘徊边缘 提交于 2019-12-04 08:52:26
multer实现图片上传: ejs代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>图片上传</title> </head> <body> <!-- 在终端安装:cnpm install multer Multer是nodejs中处理multipart/form-data数据格式(主要用在上传功能中)的中间件。该中间件不处理multipart/form-data数据格式以外的任何形式的数据 --> <!-- 单张上传 --> <h3>单张上传</h3> <form action="/uploadImg/addimg" method="post" enctype="multipart/form-data"> <input type="file" name="img" id="img1"> <input type="submit" value="提交"> </form> <!-- 多张上传 --> <h3>多张上传</h3> <form

How does Ruby know where to find a required file?

 ̄綄美尐妖づ 提交于 2019-12-04 08:51:58
Here is one more newbie question: require 'tasks/rails' I saw this line in Rakefile in the root path of every rails project. I guess this line is used to require vendor/rails/railties/lib/tasks/rails.rb to get all rake tasks loaded: $VERBOSE = nil # Load Rails rakefile extensions Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext } # Load any custom rakefile extensions Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext } Dir["#{RAILS_ROOT}/vendor/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext } My question is why only 'tasks/rails' is specified for the