php mysql网站开发,怎么给网站做关键词搜索,儿童不宜的广告,自助建站优化排名答案#xff1a;可以
创建项目#xff1a;
按照链接参考或者按官方#xff1a;
webstorm 创建vue3 vite 项目-CSDN博客 项目目录 tsconfig.json 配置允许js
allowJs指定是否编译js文件#xff0c;在任意文件当中,如果我们模块使用js写的#xff0c;那么我们需要 将all…答案可以
创建项目
按照链接参考或者按官方
webstorm 创建vue3 vite 项目-CSDN博客 项目目录 tsconfig.json 配置允许js
allowJs指定是否编译js文件在任意文件当中,如果我们模块使用js写的那么我们需要 将allowJs设置为true,默认为false,主要是在引入一个额外js之后防止路径错误才使用 {compilerOptions: {//是否对js进行编译allowJs: true}
}
打开项目之后创建一个新vue视图
login.vue
templatediv classabouth1This is an Login page/h1br/el-divider/h4{{ msg }}/h4el-button clickhandleClick这个是el按钮/el-button/div
/template
script setup
const handleClick () {msg.value msg.value ,helloalert(点了一下了55555~~~)
}
const msg ref(hello)/scriptstyle
media (min-width: 1024px) {.about {min-height: 100vh;display: flex;align-items: center;flex-direction: column;}
}
/style/router/index.ts 添加到路由
import { createRouter, createWebHistory } from vue-router
import HomeView from ../views/HomeView.vueconst router createRouter({history: createWebHistory(import.meta.env.BASE_URL),routes: [{path: /,name: home,component: HomeView},{path: /about,name: about,// route level code-splitting// this generates a separate chunk (About.[hash].js) for this route// which is lazy-loaded when the route is visited.component: () import(../views/AboutView.vue)},{path: /login,name: login,component: () import(../views/loginView.vue)}]
})export default routerApp.vue里遍历路由展示所有的页面包括上面的login.vue
templateheaderimg altVue logo classlogo src/assets/logo.svg width125 height125 /div classwrapperHelloWorld msgYou did it! /navRouterLink v-foritem of routes :toitem :keyitem.name{{ item.name }}/RouterLink/nav/div/header!--RouterLink的跳转的页面内容将在RouterView显示--RouterView /
/template
script setup langts
import { RouterLink, RouterView } from vue-router
import HelloWorld from ./components/HelloWorld.vue
import router from /routerconst routes router.options.routes
// console.log(router.options.routes)
/scriptstyle scoped
header {line-height: 1.5;max-height: 100vh;background-color: #bfc;
}.logo {/*display: block;*/display: none;margin: 0 auto 2rem 2rem;
}nav {width: 100%;font-size: 12px;text-align: center;margin-top: 2rem;
}nav a.router-link-exact-active {color: var(--color-text);
}nav a.router-link-exact-active:hover {background-color: transparent;
}nav a {display: inline-block;padding: 0 1rem;border-left: 1px solid var(--color-border);
}nav a:first-of-type {border: 0;
}media (min-width: 1024px) {header {display: flex;place-items: center;padding-right: calc(var(--section-gap) / 2);}.logo {display: block;margin: 0 2rem 0 2rem;}header .wrapper {display: flex;place-items: flex-start;flex-wrap: wrap;}nav {text-align: left;margin-left: -1rem;font-size: 1rem;padding: 1rem 0;margin-top: 1rem;}
}
/style运行效果 总结
vue3vite Typescript的项目按官方创建的项目也可以用纯JS开发新页面与新功能只不过是跟项目TS混合一起 。