想到多少写多少把,其他的想起来了在写。也写了一些css的
html
<input value="123456" type="text" v-model="account" @input="accou" class="bottom-line bottom" placeholder="请输入账号">
js
- const account = ref('')
- function accou(event) {
- account.value = event.target.value;
- console.log(account.value, '账号');
- }
禁用输入框(input)点击时出现边框效果
- input:focus {
- outline: none;
- }
图标左边
- <template>
- <input class="search-input" placeholder="Search...">
- </template>
-
- <style>
- .search-input {
- background-image: url('/path/to/search-icon.svg'); /* 指向你的搜索图标 */
- background-position: right 10px center; /* 调整图标位置 */
- background-size: 20px; /* 调整图标大小 */
- background-repeat: no-repeat;
- padding-right: 35px; /* 确保文本不会覆盖图标 */
- }
- </style>
图标右边
将meta代码
<meta name="viewport" content="width=device-width,initial-scale=1.0">
修改成为
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />

- <style>
- *{
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- style>
线性渐变是一种在一条直线上从一个颜色过渡到另一个颜色的渐变效果。
- /* 从上到下的垂直渐变 */
- .gradient {
- background: linear-gradient(to bottom, #ffcccc, #ff6666);
- }
-
- /* 从左上到右下的对角线渐变 */
- .gradient {
- background: linear-gradient(to bottom right, #ffcccc, #ff6666);
- }
径向渐变是一种从一个中心点向周围辐射渐变的效果。
- /* 从中心向外的径向渐变 */
- .gradient {
- background: radial-gradient(circle, #ffcccc, #ff6666);
- }
-
- /* 从左上角向右下角的径向渐变 */
- .gradient {
- background: radial-gradient(ellipse at top left, #ffcccc, #ff6666);
- }
在Vue 3中,当你使用localStorage.setItem('authToken', res)时,如果res是一个JavaScript对象,它会被转换成字符串并存储在localStorage中。但是,如果res本身就是一个对象,那么它会被转换成字符串并存储,这可能会导致存储的是[object Object],而不是预期的对象内容。
存
localStorage.setItem('authToken', JSON.stringify(res));
取
const authToken = JSON.parse(localStorage.getItem('authToken'));
命令
npm install vue-router@4
yarn add vue-router@4
- <script setup>
- import { useRouter } from 'vue-router';
-
- const router = useRouter();
-
- const navigateToHome = () => {
- router.push('/home'); // 使用 router.push 方法跳转到首页
- };
- </script>
-
- <template>
- <button @click="navigateToHome">Go to Home</button>
- </template>
console.log(route.path); // 打印当前路由的路径
- // 动态路由参数
- router.push({ name: 'user', params: { userId: '123' } });
-
- // 查询参数
- router.push({ path: 'register', query: { plan: 'private' } });