Vue.js

VueJS — creating a table, but being able to click a row to open that row's detail

China☆狼群 提交于 2020-12-26 08:13:12
问题 I'm new to VueJS, so this is probably a very simple problem, but here goes. I'm making a call to my API to get a set of records. I want to display those records in a simple table, but then I want to be able to click a link in the last cell of the row and be sent to a new URL -- a url for the detail of that object. Here's what I have so far: Vue Stuff: var vm = new Vue({ el: '#league-table', data: { leagues: [], apilink: '/api/leagues/', }, mounted: function() { this.getLeagues(); }, methods:

VueJS — creating a table, but being able to click a row to open that row's detail

半世苍凉 提交于 2020-12-26 08:12:50
问题 I'm new to VueJS, so this is probably a very simple problem, but here goes. I'm making a call to my API to get a set of records. I want to display those records in a simple table, but then I want to be able to click a link in the last cell of the row and be sent to a new URL -- a url for the detail of that object. Here's what I have so far: Vue Stuff: var vm = new Vue({ el: '#league-table', data: { leagues: [], apilink: '/api/leagues/', }, mounted: function() { this.getLeagues(); }, methods:

How to Auth::check() user on Laravel with API calls

南楼画角 提交于 2020-12-26 08:04:55
问题 I'm using VueJS in my front-end, so I have this API call somewhere in the front-end code: let products = axios.get('api/products'); And then in the routes/api.php :- Routes::get('products', 'ProductsController@index'); in the ProductsController 's index method: public function index () { if ( Auth::check() ) { $user = Auth::user(); return $user->products; } // return 'You don't have any products right now!'; } The index method will always return null even if the user is logged-in! So how to

How to Auth::check() user on Laravel with API calls

不羁的心 提交于 2020-12-26 08:04:50
问题 I'm using VueJS in my front-end, so I have this API call somewhere in the front-end code: let products = axios.get('api/products'); And then in the routes/api.php :- Routes::get('products', 'ProductsController@index'); in the ProductsController 's index method: public function index () { if ( Auth::check() ) { $user = Auth::user(); return $user->products; } // return 'You don't have any products right now!'; } The index method will always return null even if the user is logged-in! So how to

VueJS/Typescript - Cannot find module './components/Navigation' or its corresponding type declarations

你。 提交于 2020-12-26 07:58:47
问题 When I create a script as typescript (lang="ts") I get an error stating "Cannot find module './components/Navigation' or its corresponding type declarations (Vetur 2307).". I realized that this only happens when I set the lang as ts, which is what I need to build my Vue application. app.vue <template> <Navigation /> </template> <script lang="ts"> import Navigation from './components/Navigation'; // This is where I get the error message export default { name: 'app', components: { Navigation, }

web开发前端面试知识点目录整理

不想你离开。 提交于 2020-12-26 06:26:28
web开发前端面试知识点目录整理 基本功考察 关于Html 1. html语义化标签的理解; 结构化的理解; 能否写出简洁的html结构; SEO优化 2. h5中新增的属性; 如自定义属性 data, 类名className等, 新增表单元素, 拖拽 Drag 3. h5中新增的 API, 修改的 API, 废弃的 API 稍作了解 (离线存储, audio, video) 关于CSS 1. CSS选择器( 三大特性 ) 2. BFC机制 3. 盒模型 4. CSS模块化开发(封装); SCSS和LESS的使用 5. 屏幕适配 以及 页面自适应 6. CSS3中新增的选择器 7. CSS3中新增的属性, transform trasition animation等... 关于布局 1. 标准文档流(padding + margin + 负margin) + 浮动 float + 定位 2. 百分比布局(流式布局): px单位 用 %num代替, 占父级元素的百分比 3. flex弹性布局: 主轴 辅助轴的几个属性 4. grid栅格布局: 使用框架中的类名来替代: 本质上还是百分比布局 关于JS基础 1. 变量数据类型及检测: 基本 + 引用 2. 运算符: 算术 + 条件 + 逻辑 + 位 + 短路, 隐式转换等 3. 条件, 循环, 异常处理 if switch(){

基于vue-cli,sass,vant的移动端项目

牧云@^-^@ 提交于 2020-12-26 06:26:18
项目架构 开始 vue init webpack 项目名称 //新建项目,cd进入新项目 npm install axios //先安装! npm install --save axios vue-axios //然后! npm install vuex --save //安装vuex npm i vant -S //安装vant,Ui框架,选择性安装 npm install babel-plugin-import -D // 与vant是绑定安装关系 配置babelrc文件 "plugins": [ "transform-vue-jsx", "transform-runtime", ["import", [{ "libraryName": "vant","libraryDirectory":"es","style": true }] ] 然后可以在模块中引入或全局引入,本人采用全局引入 import { Button } from 'vant' Vue.use(Button) npm install --save-dev node-sass sass-loader //安装sass npm install mockjs //选择性安装,mock数据 打开webpack.base.config.js在loaders里面加上 { test: /\.scss$/, loaders: [

Vue中修改el-table的表头颜色,及多选框 表头的样式none

北战南征 提交于 2020-12-26 06:24:16
修改表头背景颜色及其他,它有个属性, header-cell-style可以修改它 的背景及其他 好吧,怎么样去除左上角的那一个全选按钮呢 当然是样式none不就行了,不好意思没想到,这是是写到scoped里面的哈 #boxbox /deep/ thead .el-table-column--selection .cell{   display: none; } 覆盖样式贯穿 可以用 >>> 和 /deep/ 来警醒样式贯穿 搞定。当然你也可以另外写style这个不写scoped,这么写的话会全局污染的,其他地方用el-table的话样式一样 效果一样,注意这里不用贯穿 来源: oschina 链接: https://my.oschina.net/u/4396177/blog/3475730

splice not working with a array row vue js

狂风中的少年 提交于 2020-12-26 05:14:56
问题 I have a Object array but when i want remove a object from array list only items are deleted from the end <div class="hours" v-for="(time, index) in hour" :key="index"> then I put the click function on an icon <b-icon v-if="time.delete" icon="x" width="20" height="20" class="delete-time" @click="deleteTime(index)" ></b-icon> but when I go to do the delete methods: { moment, deleteTime(index) { this.hour.splice(index, 1); }, 回答1: I discovered that the challenge is that you need to add a unique

为什么说一定要读Vue3.0源码?

寵の児 提交于 2020-12-26 00:58:51
最近后台有读者问,刷知乎/公众号/ 掘金/CSDN的时候 ,看到好多分析Vue3源码的文章,但是感觉除了面试能用上,工作中基本用不到,特别是Vue3现在生态都还不完善,这时候读Vue3源码有必要吗? 我想说,就光 【 面试能用到 】 这一条就该给你足够的动力了吧? 更何况,阅读Vue3源码的好处远不止于此。 ‍‍‍‍‍‍‍1. 阅读Vue3源码让你更加熟悉 Vue 框架,能更快解决工作中遇到的问题 2. 你能借鉴优秀源码的经验,学习高手思路。一个是项目中问题的解决思路,一个是写代码的思路,培养“造轮子”的能力 3. 你可以学习怎么写出规范又好维护的代码 4. 提升自己解读源码的能力,读源码本身就是一个很好的学习方式,掌握了如何阅读源码,将来在你学习其他框架或者是新接手项目的时候,都可以通过阅读源码的方式快速上手 说了这么多阅读源码的好处,到底怎么去阅读源码呢?市面上各种源码解读的文章多以贴源码的方式带你解读,但问题是, 我就是不明白它为啥这样写呀! 因此,给大家推荐个 不一样 的课程,由 Vue3.0 Contributor 精心打磨的《Vue 3.0 源码进阶训练营》,这个训练营通过 手写Vue3.0核心源码的 的形式带你 深入理解 Vue 的底层原理,破解面试难题 ;通过 实战造轮子 带你快速上手Vue3.0应用于项目开发 ; 还有助教全天答疑,不用担心被难点困住。