当前位置: 首页 > news >正文

制作网站哪家强绍兴seo推广

制作网站哪家强,绍兴seo推广,百度客户端官网,佛山网络科技公司有哪些往期内容 《Vue零基础入门教程》第六课:基本选项 《Vue零基础入门教程》第八课:模板语法 《Vue零基础入门教程》第九课:插值语法细节 《Vue零基础入门教程》第十课:属性绑定指令 《Vue零基础入门教程》第十一课:事…

 往期内容

《Vue零基础入门教程》第六课:基本选项

《Vue零基础入门教程》第八课:模板语法

《Vue零基础入门教程》第九课:插值语法细节

《Vue零基础入门教程》第十课:属性绑定指令

《Vue零基础入门教程》第十一课:事件绑定指令

《Vue零基础入门教程》第十二课:双向绑定指令

《Vue零基础入门教程》第十三课:条件渲染

《Vue零基础入门教程》第十四课:列表渲染

1) 什么是样式绑定

通过绑定class属性 或者 style属性 修改样式

2) 绑定class属性

常见有两种语法

  • 数组写法
  • 对象写法

示例

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Document</title><script src="../node_modules/vue/dist/vue.global.js"></script><style>.red {color: red;}.blue {color: skyblue;}</style></head><body><div id="app"><!-- 原生的写法 --><span class="red blue">一段文字</span><!-- 绑定class属性 -- 对象的写法 --><span :class="obj">对象的写法</span><!-- 绑定class属性 -- 数组的写法(推荐) --><span :class="arr">数组的写法</span><span :class="foo">绑定一个变量</span><span :class="flag ? 'red' : 'blue'">使用表达式</span></div><script>const { createApp } = Vueconst vm = createApp({data() {return {obj: {red: true,blue: true,},arr: ['red', 'blue'],foo: 'red',flag: true,}},}).mount('#app')</script></body>
</html>

3) 绑定style属性

对象写法

示例

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Document</title><script src="../node_modules/vue/dist/vue.global.js"></script></head><body><div id="app"><!-- 原生的写法 --><div style="font-size: 32px; color: red">原生的写法</div><!-- 绑定style属性 -- 对象写法 --><div :style="obj">对象的写法</div></div><script>const { createApp } = Vueconst vm = createApp({data() {return {obj: {// 'font-size': '32px',fontSize: '32px',color: 'red',},}},}).mount('#app')</script></body>
</html>

4) 作业
💡 需求
实现京东tab栏切换

GIF.gif

参考答案

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Document</title><!-- 1.1 引入vue.js --><script src="../node_modules/vue/dist/vue.global.js"></script><!-- 2.2 实例静态页面(CSS部分) --><style>* {margin: 0;padding: 0;}li {list-style: none;}.menu-tab {display: flex;justify-content: space-between;margin: 50px auto;height: 40px;width: 700px;border: 1px solid #eee;border-bottom: 1px solid #e4393c;background-color: #f7f7f7;box-sizing: border-box;}.menu-tab .menu-item {flex: 1;display: flex;justify-content: center;align-items: center;font-size: 14px;color: #666;cursor: pointer;}.menu-tab .menu-item:hover {color: #e4393c;}.menu-tab .menu-item.current {color: #fff;background-color: #e4393c;}</style></head><body><!-- 1.2 编写页面容器 --><div id="app"><!-- 2.1 实例静态页面(HTML部分) --><ul class="menu-tab"><!-- <liv-for="(item, index) in items"class="menu-item":class="index == active ? 'current' : '' "@click="active = index"> --><liv-for="(item, index) in items"class="menu-item":class="index == active ? 'current' : '' "@click="handleClick(index)">{{item}}</li></ul></div><!-- 1.3 创建vue实例对象 --><script>const { createApp } = Vueconst vm = createApp({data() {return {items: ['商品介绍', '规格与包装', '售后保障', '商品评价(2000+)', '手机社区'],active: 0,}},methods: {handleClick(i) {console.log(i)this.active = i},},}).mount('#app')</script></body>
</html>

http://www.yayakq.cn/news/372690/

相关文章:

  • 网站建设唯地带企业宣传如何做网站
  • 网站后台模板 html南京电子商务网站开发公司
  • 东至县住房和城乡建设网站淮阴区建设局网站
  • 网站如何做点击链接企业系统规划
  • 番禺网站制作设计网站的需求分析都有哪些内容
  • 做网站与做软件怎么做网站引流
  • 做外贸女装有哪些网站用自己电脑做网站服务器-phpstudy+花生壳
  • 网站租用空间价格网页视频下载脚本
  • Dedecms手机网站源码wordpress自定义按钮
  • 网页.网站.主页.网址.域名有什么联系网站开发和运作的财务预算
  • 网站所有者是什么意思企业网站备案价格
  • python可以做网站常用设计网站有哪些软件
  • 百家号和网站同步做海外推广营销系统
  • 建网站需要什么步骤无版权的图片素材网站
  • 企查查网站多久可以做网站
  • 唯品会网站开发找人代做网站需要注意什么
  • 唐河网站制作wordpress添加优酷视频播放器
  • asp.net 网站截图网站制作方案专业乐云seo
  • js模版网站天津建设工程信息网的信用分
  • 网站加首页手机装修设计图制作软件
  • 动漫网站设计源代码南充网站建设选略奥
  • 网络营销与电子商务的区别贵州seo推广
  • 培训网站欣赏一二年级的科技小制作
  • 南宁做网站方案马云先做那个网站的起家的
  • 公司网站开发费用济南兴田德润评价企业宣传片制作拍摄
  • 这几年做啥网站致富武昌便宜做网站
  • server 2008 iis部署网站seo自学
  • 郴州网站建设公司有哪些电商网站推广常见问题
  • 门户系统设计中国网站优化哪家好
  • 创建微网站wordpress后台打开太慢