小编Ala*_*lan的帖子

在 vue 3 组合 API 中删除响应式对象上的代理

我陷入了反应性问题。我正在使用 Stein 在谷歌表格中创建后端。Stein 非常挑剔,希望以 [{}] 格式请求。我做了以下事情:

模板:

<div class="field">
  <label class="label">Model #</label>
  <div class="control">
    <input
      class="input"
      placeholder="Model #"
      v-model="form.ModelNum"
    />
  </div>
</div>

<div class="field">
  <label class="label">Bar Code</label>
  <div class="control">
    <input
      class="input"
      placeholder="Bar Code"
      v-model="form.Barcode"
    />
  </div>
</div>

<div class="field">
  <label class="label">Serial #</label>
  <div class="control">
    <input
      class="input"
      placeholder="Serial #"
      v-model="form.SerialNum"
    />
  </div>
</div>
//etc
Run Code Online (Sandbox Code Playgroud)

JS

<script setup>
import { reactive, defineEmits, toRefs } from "vue";
import addRow from "../helperFunctions/addRow.js";

// Variables
let form = reactive({
  Equipment: "",
  Make: "",
  ModelNum: "", …
Run Code Online (Sandbox Code Playgroud)

vue-reactivity vuejs3 vue-composition-api

9
推荐指数
1
解决办法
9348
查看次数

在 Vue Compostion API 中使用 querySelector()

我是 Vue Composition API 的新手,需要使用document.querySelector. 但是,它并没有按预期工作。如果我写

<nav class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">

<script setup>
import { ref } from "vue";
const observer = new IntersectionObserver(handleIntersection);
const target = document.querySelector(".home-menu");
observer.observe(target);
console.log(target);
Run Code Online (Sandbox Code Playgroud)

targetnull。阅读文档,我看到了该ref属性,如果我

<nav ref="navbar" class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">
<script setup>
import { ref } from "vue";

const target = ref("navbar");
console.log(target);
Run Code Online (Sandbox Code Playgroud)

记录一个对象。

ref在 Composition API 中获取 DOM 元素的方式吗?
我现在可以target在我的观察者对象中使用吗?
它相当于吗querySelector

我试过

import { ref } from "vue";
const …
Run Code Online (Sandbox Code Playgroud)

vue.js vuejs3 vue-composition-api

8
推荐指数
2
解决办法
2万
查看次数

如何从 Vue Composable 触发 $emit 事件

我有一个需要触发事件的 vue 可组合项。我天真地设置如下:

*// composable.js*
import { defineEmits } from "vue";

export default function useComposable() {
  // Vars
  let buffer = [];
  let lastKeyTime = Date.now();
  const emit = defineEmits(["updateState"]);

document.addEventListener("keydown", (e) => {
    // code
    emit("updateState", data);
   }

// *App.vue*
<template>
<uses-composables
    v-show="wirtleState.newGame"
    @updateState="initVars"
  ></uses-composables>
</template>
<script setup>
const initVars = (data) => {
//code here

}

// usesComposable.vue
<template>
  <button @click="resetBoard" class="reset-button">Play Again</button>
</template>

<script setup>
import { defineEmits } from "vue";
import useEasterEgg from "@/components/modules/wirdle_helpers/useEasterEgg.js";


useEasterEgg();
</script> …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-events vue-composition-api

6
推荐指数
2
解决办法
1万
查看次数

如何使用 php imap_sort 排序和检索最后 10 条消息

我想从 Gmail 帐户检索最后 10 条消息并将其显示在页面中。到目前为止我有以下内容:

<!DOCTYPE html>
<html lang="en">
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
    <!--    <!--[if lt IE 9]>
            <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    <link href="css/styles.css" rel="stylesheet">

<!--<link rel="stylesheet" href="mail.css"/> -->

</head>

<body>
<?php

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
/* connect to gmail */
$user = '*****';
$password = '*********';
$mailbox = "{imap.gmail.com:993/imap/ssl}INBOX";

?>

<?php
$mbx = imap_open($mailbox , $user , $password);

/*imap_check returns information about the mailbox
including mailbox name and number of messages*/
//$check = imap_check($mbx);


/* grab emails */
$emails = imap_search($mbx, …
Run Code Online (Sandbox Code Playgroud)

php imap

5
推荐指数
1
解决办法
4197
查看次数

安装 posh-git 时遇到问题

我想在笔记本电脑上安装 posh-git,但是当我尝试使用命令“PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force”安装时,出现错误:

Install-Module : A parameter cannot be found that matches parameter name
'AllowPrerelease'.
At line:1 char:58
+ ... et\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
+                                                   ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], Paramet
   erBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Install-Module
Run Code Online (Sandbox Code Playgroud)

阅读 github 站点上的勘误表,我看到它说我需要使用“Install-Module PowerShellGet -S cop CurrentUser -Force -AllowClobber”更新我的 PowerShellGet 模块,但这会产生错误:

PackageManagement\Install-Package : The module 'PackageManagement' cannot be
installed or updated because the authenticode signature of the file
'PackageManagement.cat' is not valid.
At C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809
char:21 …
Run Code Online (Sandbox Code Playgroud)

powershell posh-git

5
推荐指数
1
解决办法
3468
查看次数

为 PostCSS 设置配置文件

我正在使用 PostCSS,我想添加 Post-uncss。我不使用任务运行器,只使用 Postcss-cli。我的 package.json 现在看起来像这样:

"css-clean": "npx postcss src\\css\\main.css -u autoprefixer --replace && npx postcss src\\css\\main.css -u css-declaration-sorter --replace --no-map"
Run Code Online (Sandbox Code Playgroud)

它变得相当长。我看到提到 PostCSS 可以有一个配置文件“postcss.config.js”。文章中唯一提到的就是骨架:

module.exports = {
    plugins: {
      'autoprefixer': {},
      'css-declaration-sorter': {}
    }
  };
Run Code Online (Sandbox Code Playgroud)

uncss 文档只说选项:

{
  html: ['index.html', 'about.html', 'team/*.html'],
  ignore: ['.fade']
}
Run Code Online (Sandbox Code Playgroud)

我希望如果有人有使用配置文件的经验来提供一些建议,因为我不相信这个功能是有据可查的。

html css postcss

2
推荐指数
1
解决办法
3334
查看次数

bootstrap-vue &lt;b-pagination&gt; 组件在点击时不会改变页面

我想实现一个分页组件 b-pagination w/bootstrap-vue 但它只会显示第一页。我正在遵循文档中的设置,但它们只显示了一个使用表格而不是无序列表的示例。我有 :

<template>
  <div class="results overflow-auto" v-cloak>
    <h3>Search Results</h3>

    <modal v-if="showModal" @close="showModal = false">
      <!--
      you can use custom content here to overwrite
      default content
      -->
      <template v-slot:header>
        <h1>NASA Image</h1>
      </template>

      <template v-slot:body>
        <b-img class="modal-image" v-bind:src="attribute"></b-img>
      </template>
    </modal>

    <!-- ======== Pagination Markup  ============ -->
    <b-pagination
      v-model="currentPage"
      :total-rows="rows"
      :per-page="perPage"
      :items="items"
      aria-controls="my-list"
    ></b-pagination>

    <p class="mt-3">Current Page: {{ currentPage }}</p>

    <!-- ==========End Pagination Markup ======== -->

    <!-- Limit output to 100 items -->

    <ul
      class="search-results"
      id="my-list"

    >
      <li v-for="(item, index) …
Run Code Online (Sandbox Code Playgroud)

vue.js bootstrap-vue

0
推荐指数
1
解决办法
2513
查看次数