使用vue-cli构建工具构建vue项目时候组件的使用
<template>
<div class="contains">
<!-- <div class="main">
<swiper :options='swiperOption' :not-next-tick=''></swiper>
</div> -->
<slide > <div v-for="(item,index) in banner" :data='sliderarr' :key="item+index">
<a>
<!-- <img class="clicks" :src='item.img_url' @load="loadImg" @click='goto_url()'> -->
<img class="clicks" :src='item.img_url' @click='goto_url()'>
</a>
</div>
</slide>
<p class="news"><b>幸运栏</b><span>恭喜{{users}}在{{games}}中获得<em>{{count}}</em>个金币</span></p>
</div>
</template> <script>
import {swiper,swiperSlide} from 'vue-awesome-swiper'
import slide from '../oslider'
export default{
components: {
slide
},
data () {
return {
sliderarr:[],
banner:[
{
img_url: "", },
{ }
], users:'“千尺干头”',
count:'8288',
games:'猜球游戏'
}
},
methods: {
goto_url(){ }
}
}
</script> <style lang="scss" scoped>
@import 'swiper/dist/css/swiper.css';
.contains{
p{
margin:0;
padding:0;
width:100%;
}
}
.news{
b{
// display: inline-block;
padding:0.02rem;
border-radius: 0.02rem;
background-color: #64ce66;
font-size: 0.12rem !important;
margin-left: 0.2rem;
margin-right: 0.2rem;
color:#fff;
}
span{
font-weight: bolder;
}
em{
color:#c11f2e;
font-style: normal;
}
background: #f6f6f6;
height: 0.5rem;
line-height: 0.5rem;
font-size: 0.14rem;
}
</style>
一般情况下的APP首页会单独拿出来做为一个组件,首页里面的内容就需要考虑 组件化开发;
再建立其他组件文件夹;
例如一个子组件需要渲染再index组件中;
子组件代码如上,这个里面只需要写组件内的代码不需要管其他;
然后再在根组件中导入。声明,使用;如下根组件代码
<template>
<div class="home">
<Heador/>
<Slider/>
<Plays/>
<Hotgame/>
<Footballguess/>
<Basketballguess/>
<Hotreward/>
</div>
</template> <script>
import Heador from "../components/index/heador.vue"
import Slider from "../components/index/Slider.vue"
import Plays from "../components/index/plays.vue"
import Hotgame from "../components/index/Hotgame"
import Footballguess from "../components/index/FootballGuess"
import Basketballguess from "../components/index/BasketballGuess"
import Hotreward from "../components/index/Hotreward" export default {
components: {
Heador,
Slider,
Plays,
Hotgame,
Footballguess,
Basketballguess,
Hotreward
},
name:"home"
}
</script> <style lang="scss"> </style>
使用vue-cli构建工具构建vue项目时候组件的使用的更多相关文章
- vue.js---利用vue cli脚手架工具+webpack创建项目遇到的坑
1.Eslint js代码规范报错 WARNING Compiled with 2 warnings 10:43:26 ✘ http://eslint.org/docs/rules/quotes St ...
- 深入浅出的webpack构建工具--webpack4+vue搭建环境 (十三)
深入浅出的webpack构建工具--webpack4+vue搭建环境 (十三) 从上面一系列的webpack配置的学习,我们现在来使用webpack来搭建vue的开发环境.首先我们来设想下我们的项目的 ...
- 深入浅出的webpack构建工具--webpack4+vue+router项目架构(十四)
阅读目录 一:vue-router是什么? 二:vue-router的实现原理 三:vue-router使用及代码配置 四:理解vue设置路由导航的两种方法. 五:理解动态路由和命名视图 六:理解嵌套 ...
- 深入浅出的webpack4构建工具--webpack4+vue+route+vuex项目构建(十七)
阅读目录 一:vue传值方式有哪些? 二:理解使用Vuex 三:webpack4+vue+route+vuex 项目架构 回到顶部 一:vue传值方式有哪些? 在vue项目开发过程中,经常会使用组件来 ...
- vue cli 3.0快速创建项目
本地安装vue-cli 前置条件 更新npm到最新版本 命令行运行: npm install -g npmnpm就自动为我们更新到最新版本 淘宝npm镜像使用方法 npm config set reg ...
- 前端——Vue CLI 3.x搭建Vue项目
一.Node安装 windows 1. Node.js (>=8.9, 推荐8.11.0+) Node官网下载 .msi 文件,按步骤下载安装即可. 安装完之后在cmd中输入 node -v,若 ...
- 基于vue cli 3.0创建前端项目并安装cube-ui
前提条件: 安装node.js. 国内的开发者最好先配置淘宝镜像. 之后用cnpm来代替npm命令. 项目创建过程: 打开cmd,输入命令进入目标工作空间,以本机项目为例: cd /d d: cd D ...
- 使用vue/cli 创建一个简单的项目
首先,电脑安装了node.js官方要求8.9 或更高版本 (推荐 8.11.0+) npm install -g @vue/cli # OR yarn global add @vue/cli 全局安装 ...
- ubuntu下安装vue/cli提示No command 'vue' found
通过官方指令 npm install -g @vue/cli 安装vue脚手架提示: No command 'vue' found, did you mean: Command 'vpe' from ...
随机推荐
- laravel 框架增删改查+数据恢复
...............路由页面 //修改页面的自定义路由Route::post('unigoods/updata','uniGoodsController@updata');//数据恢复Rou ...
- 7月2日 Django 生成验证码、
html页面里 {# 验证码 #} <div class="form-group " id="v-code-wrapper"> <label ...
- First Note
第一篇博客 入驻博客园.
- 恢复训练(学不动了摸会鱼) Pt. 1
本来下午想把pre稿子写了,咕咕咕. 群论是啥也不会了,写个polya试试(手动doge)为什么博客媛没有emoji,以后万一自己搭博客一定要加上这个小东西 polya淼题:poj1286 先复吸一下 ...
- Spring Authorization Server 0.2.3发布,放出联合身份DEMO
很快啊Spring Authorization Server又发新版本了,现在的版本是0.2.3.本次都有什么改动呢?我们来了解一下. 0.2.3版本特性 本次更新的新特性不少. 为公开客户端提供默认 ...
- setTimeout时间延迟为何不准?
单线程, 先执行同步主线程, 再执行异步任务队列
- python实现AES加密、解密
AES加密方式有五种:ECB, CBC, CTR, CFB, OFB 从安全性角度推荐CBC加密方法,本文介绍了CBC,ECB两种加密方法的python实现 python 在 Windows下使用AE ...
- Java并发机制(8)--concurrent包下辅助类的使用
Java并发编程:concurrent包下辅助类的使用 整理自:博客园-海子-http://www.cnblogs.com/dolphin0520/p/3920397.html 1.CountDown ...
- java-属性集properties+加载配置文件
简介 /* 使用properties集合存储数据,遍历取出properties集合中的数据 properties集合有一些操作字符串的特有方法 Object setProperty(String ke ...
- 什么是 Spring 配置文件?
Spring 配置文件是 XML 文件.该文件主要包含类信息.它描述了这些类是如何 配置以及相互引入的.但是,XML 配置文件冗长且更加干净.如果没有正确规划 和编写,那么在大项目中管理变得非常困难.