
目录
01 - 注册并登录百度账号 百度地图开放平台 | 百度地图API SDK | 地图开发
npm i vite -g
npm init vue@latest

在 public目录 下,添加一个 favicon.icon 图片
在 index.html 文件的 title标签 中配置
能让 代码提示 变得更加友好
{
"compilerOptions": {
// "target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"vueCompilerOptions": {
"experimentalDisableTemplateSupport": true
}
}
{
"printWidth": 120,
"singleQuote": true,
"bracketSpacing": true,
"jsxBracketSameLine": false,
"htmlWhitespaceSensitivity": "ignore",
"useTabs": false,
"tabWidth": 2,
"endOfLine": "lf",
"trailingComma": "none",
"semi": true,
"eslintIntegration": true
}
代码片段生成网址 : snippet generator
"vue3": {
"prefix": "vue3",
"body": [
"<!-- ? ${2}模块 -->",
"<template>",
" <div class=\"${1}-view\">",
" <h2>${1}</h2>",
" </div>",
"</template>",
"",
"<script setup>",
"import { ref } from 'vue';",
"</script>",
"",
"<style lang=\"scss\" scoped>",
".${1}-view {",
"}",
"</style>",
""
],
"description": "vue3"
}
设置 => 配置用户代码片段 => vue.json => copy
使用设置的title即可 => tab键 切换占位符1. 2. 3. 4 ...
存放 => 静态资源
存放 => 公共组件
存放 => 公共常用的hook
存放 => 模拟接口数据
存放 => 路由管理
存放 => 接口请求
存放 => 状态管理
存放 => 插件、第三方插件
存放 => 视图、页面

自定义的css公共文件放置在assets中的css文件中即可
npm i normalize.css
// 在 main.js 中引入
import 'normalize.css';
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
font,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
caption {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
table,
tbody,
tfoot,
thead,
tr,
th,
td {
margin: 0;
padding: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
button,
input,
textarea {
margin: 0;
padding: 0;
}
/* form elements 表单元素 */
body,
button,
input,
select,
textarea {
font: normal 12px/1.5 '\5FAE\8F6F\96C5\9ED1', tahoma, arial;
}
/*设置的字体,行高*/
h1,
h2,
h3,
h4,
h5,
h6,
th {
font-size: 100%;
font-weight: normal;
}
/*重置标题*/
address,
cite,
dfn,
var {
font-style: normal;
}
/* 将斜体扶正 */
code,
kbd,
pre,
samp {
font-family: 'courier new', courier, monospace;
}
/* 统一等宽字体 */
small {
font-size: 12px;
}
/* 小于 12px 的中文很难阅读,让 small 正常化 */
ul,
ol {
list-style: none;
}
/* 重置列表元素 */
button,
input[type="submit"],
input[type="button"] {
cursor: pointer;
}
input[type="radio"],
input[type="checkbox"],
input[type="submit"],
input[type="reset"] {
vertical-align: middle;
cursor: pointer;
border: none;
}
/** 重置文本格式元素 **/
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:focus {
outline: 0;
}
sup {
vertical-align: text-top;
}
/* 重置,减少对行高的影响 */
sub {
vertical-align: text-bottom;
}
/** 重置表单元素 **/
legend {
color: #000;
}
/* for ie6 */
fieldset,
img {
border: 0;
}
/* img 搭车:让链接里的 img 无边框 */
button,
input,
select,
textarea {
background: transparent;
font-size: 100%;
outline: 0;
}
/* 使得表单元素在 ie 下能继承字体大小 */
/* 注:optgroup 无法扶正 */
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
vertical-align: middle;
}
/** 重置表格元素 **/
/* 重置 HTML5 元素 */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
summary,
time,
mark,
audio,
video {
display: block;
margin: 0;
padding: 0;
}
/*回复标签重置*/
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
display: none;
}
// 在 main.js 中引入
import './assets/css/reset.css';
// 清除浮动
.clearfix {
*zoom: 1;
}
......
// 在 main.js 中引入
import './assets/css/common.css';
npm i vue-router
在 router文件夹 中的 index.js 中进行配置
// 1. 导入
import { createRouter, createWebHashHistory } from 'vue-router';
// 2. 创建路由对象
const router = createRouter({
history: createWebHashHistory(),
routes: [
{
path: '/',
redirect: '/home'
},
{
path: '/home',
component: () => import('xxx/home.vue')
}
]
});
// 3. 导出
export default router;
// main.js
import { createApp } from 'vue';
import App from './App.vue';
// 1. 导入
import router from './router';
import 'normalize.css';
import './assets/css/reset.css';
import './assets/css/common.css';
// 2. 使用
createApp(App).use(router).mount('#app');
在该用的地方加上 <router-view/>
npm i pinia
在 stores文件夹 中创建 index.js
// 1. 导入
import { createPinia } from 'pinia'
// 2. 创建
const pinia = createPinia()
// 3. 导出
export default pinia
// main.js
import { createApp } from 'vue';
import App from './App.vue';
// 1. 导入
import router from './router';
import 'normalize.css';
import './assets/css/reset.css';
import './assets/css/common.css';
// 2. 使用
createApp(App).use(router).mount('#app');
在 stores文件夹 中创建 modules , 在其中创建模块
// 1. 导入
import { defineStore } from 'pinia';
// 2. 使用
const useDemoStore = defineStore('demoStore', {
state: () => ({
arrList: []
}),
actions: {},
getters: {}
});
// 3. 导出
export default useDemoStore;
git init
这里设定的是针对该仓库的配置
git config --local user.name 'xxxx'
git config --local user.email 'xxxx@qq.com'
git add .
git commit -m 'feat: 项目初始化'

git remote add origin https://xxxxxx.git
git push -u origin master


应用管理 > 我的应用


ps : 可查看hello world

<!-- 这里使用了3.0的版本,把AK复制上去 -->
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&&type=webgl&ak=您的密钥">
</script>
<!-- ? 地图模块 -->
<template>
<div class="detail-map-view">
<!-- 1. 地图需要一个HTML元素作为容器 -->
<div class="detail-map" ref="detailMapRef"></div>
</div>
</template>
<script setup>
import { onMounted, ref } from 'vue';
const detailMapRef = ref(null);
onMounted(() => {
// 2. 创建地图实例,传入地图容器,地图容器的ID为detailMapRef,即上面的<div>,地图容器必须是一个独立的div
const map = new BMapGL.Map(detailMapRef.value);
// 3. 创建点坐标,经度116.404,纬度39.915,可以通过百度地图API获取,也可以自己设置
const point = new BMapGL.Point(116.404, 39.915);
// 4. 初始化地图,设置中心点坐标和地图级别, 15为地图级别,数值越大,地图越精细
map.centerAndZoom(point, 15);
// 5. 创建标注,传入坐标
var marker = new BMapGL.Marker(point);
// 6. 将标注添加到地图中
map.addOverlay(marker);
});
</script>
<style lang="less" scoped>
.detail-map-view {
width: 100%;
height: 300px;
.detail-map {
width: 100%;
height: 100%;
}
}
</style>

import { ref, onActivated, onDeactivated, onMounted, onUnmounted } from 'vue';
import { throttle } from 'underscore';
export default function usePageScroll(domRef) {
// 默认监听window窗口滚动事件
let dom = window;
// 是否滚动到底部
const isArriveBottom = ref(false);
// 滚动条滚动高度
const scrollTop = ref(0);
// 页面可视区域高度
const scrollHeight = ref(0);
// 页面总高度
const clientHeight = ref(0);
const scrollListen = throttle(() => {
// 如果传入了domRef,则获取domRef的高度的值,否则获取window窗口的高度
const heightData = domRef ? domRef.value : document.documentElement;
// 获取滚动条滚动高度,已经滚动的距离
scrollTop.value = heightData.scrollTop;
// 获取页面总高度
scrollHeight.value = heightData.scrollHeight;
// window => 获取可见区域高度 (667)
clientHeight.value = heightData.clientHeight;
// const { scrollTop, scrollHeight, clientHeight } = document.documentElement;
// 判断是否滚动到底部 => 滚动高度 + 可视区域高度 >= 总高度时,加载更多
if (scrollTop.value + clientHeight.value >= scrollHeight.value) {
// 滚动到底部
console.log('滚动到底部了');
isArriveBottom.value = true;
}
// console.log(scrollTop.value, scrollHeight.value, clientHeight.value);
}, 100);
// 监听window窗口滚动事件
onMounted(() => {
// 如果传入了domRef,则监听domRef的滚动事件
if (domRef) dom = domRef.value;
dom.addEventListener('scroll', scrollListen);
});
onActivated(() => {
dom.addEventListener('scroll', scrollListen);
});
// 取消监听window窗口滚动事件
onUnmounted(() => {
dom.removeEventListener('scroll', scrollListen);
});
onDeactivated(() => {
dom.removeEventListener('scroll', scrollListen);
});
// 返回数据
return { isArriveBottom, scrollTop, scrollHeight, clientHeight };
}
<!-- ? 收藏模块 -->
<template>
<div class="favor-view" ref="favorViewRef">
<template v-for="item in 100">
<div>列表数据:{{ item }}</div>
</template>
</div>
</template>
<script setup>
import usePageScroll from '@/hooks/usePageScroll';
import { ref, watchEffect } from 'vue';
const favorViewRef = ref(null);
const { scrollTop } = usePageScroll(favorViewRef);
watchEffect(() => {
console.log(scrollTop.value);
});
</script>
<style lang="less" scoped>
.favor-view {
height: 300px;
overflow-y: auto;
}
</style>

在vite中,加载图片须得转换一下
export const getAssetURL = (image) => {
// 参数一: 相对当前路径来配置路径
// 参数二: 当前路径的URL
return new URL(`../assets/img/${image}`, import.meta.url).href
}
<!-- ? 底部tabber模块 -->
<template>
<img class="icon" :src="getAssetURL('tabbar/tab_favor.png')" />
</template>
<script setup>
import { getAssetURL } from '@/utils/load_assets';
</script>
如何在buildr项目中使用Ruby?我在很多不同的项目中使用过Ruby、JRuby、Java和Clojure。我目前正在使用我的标准Ruby开发一个模拟应用程序,我想尝试使用Clojure后端(我确实喜欢功能代码)以及JRubygui和测试套件。我还可以看到在未来的不同项目中使用Scala作为后端。我想我要为我的项目尝试一下buildr(http://buildr.apache.org/),但我注意到buildr似乎没有设置为在项目中使用JRuby代码本身!这看起来有点傻,因为该工具旨在统一通用的JVM语言并且是在ruby中构建的。除了将输出的jar包含在一个独特的、仅限ruby
我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘
我已经像这样安装了一个新的Rails项目:$railsnewsite它执行并到达:bundleinstall但是当它似乎尝试安装依赖项时我得到了这个错误Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcheckingforlibkern/OSAtomic.h...yescreatingMakefilemake"DESTDIR="cleanmake"DESTDIR="
假设我有这个范围:("aaaaa".."zzzzz")如何在不事先/每次生成整个项目的情况下从范围中获取第N个项目? 最佳答案 一种快速简便的方法:("aaaaa".."zzzzz").first(42).last#==>"aaabp"如果出于某种原因你不得不一遍又一遍地这样做,或者如果你需要避免为前N个元素构建中间数组,你可以这样写:moduleEnumerabledefskip(n)returnto_enum:skip,nunlessblock_given?each_with_indexdo|item,index|yieldit
项目介绍随着我国经济迅速发展,人们对手机的需求越来越大,各种手机软件也都在被广泛应用,但是对于手机进行数据信息管理,对于手机的各种软件也是备受用户的喜爱小学生兴趣延时班预约小程序的设计与开发被用户普遍使用,为方便用户能够可以随时进行小学生兴趣延时班预约小程序的设计与开发的数据信息管理,特开发了小程序的设计与开发的管理系统。小学生兴趣延时班预约小程序的设计与开发的开发利用现有的成熟技术参考,以源代码为模板,分析功能调整与小学生兴趣延时班预约小程序的设计与开发的实际需求相结合,讨论了小学生兴趣延时班预约小程序的设计与开发的使用。开发环境开发说明:前端使用微信微信小程序开发工具:后端使用ssm:VU
@作者:SYFStrive @博客首页:HomePage📜:微信小程序📌:个人社区(欢迎大佬们加入)👉:社区链接🔗📌:觉得文章不错可以点点关注👉:专栏连接🔗💃:感谢支持,学累了可以先看小段由小胖给大家带来的街舞👉微信小程序(🔥)目录自定义组件-behaviors 1、什么是behaviors 2、behaviors的工作方式 3、创建behavior 4、导入并使用behavior 5、behavior中所有可用的节点 6、同名字段的覆盖和组合规则总结最后自定义组件-behaviors 1、什么是behaviorsbehaviors是小程序中,用于实现
我正在尝试创建一个带有项目符号字符的Ruby1.9.3字符串。str="•"+"helloworld"但是,当我输入它时,我收到有关非ASCII字符的语法错误。我该怎么做? 最佳答案 你可以把Unicode字符放在那里。str="\u2022"+"helloworld" 关于ruby-如何在Ruby字符串中插入项目符号字符?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1195
我的Rails站点使用了一个确实不是很好的gem。每次我需要做一些新的事情时,我最终不得不花费与向实际Rails项目添加代码一样多的时间来为gem添加功能。但我不介意,我将我的Gemfile设置为指向我的gem的GitHub分支(我尝试提交PR,但维护者似乎已经下台)。问题是我真的没有找到一种合理的方法来测试我添加到gem的新东西。在railsc中测试它会特别好,但我能想到的唯一方法是a)更改~/.rvm/gems/.../foo。rb,这看起来不对或者b)升级版本,推送到Github,然后运行bundleup,这除了耗时之外显然是一场灾难,因为我不确定我所做的promise是否正
我一直在尝试使用nanoc用于生成静态网站。我需要组织一个复杂的排列页面,我想让我的内容保持干燥。包含或合并的概念在nanoc系统中如何运作?我已阅读文档,但似乎找不到我想要的内容。例如:我如何获取两个部分内容项并将它们合并到一个新的内容项中。在staticmatic您可以在您的页面中执行以下操作。=partial('partials/shared/navigation')类似的约定在nanoc中如何运作? 最佳答案 这里是nanoc的作者。在nanoc中,部分是布局。因此,您可以拥有layouts/partials/shared/
我安装了ruby、yeoman,当我运行我的项目时,出现了这个错误:Warning:Running"compass:dist"(compass)taskWarning:YouneedtohaveRubyandCompassinstalledthistasktowork.Moreinfo:https://github.com/gruUse--forcetocontinue.Use--forcetocontinue.我有进入可变session目标的路径,但它不起作用。谁能帮帮我? 最佳答案 我必须运行这个:geminstallcom