我有一个 div,里面有文本,有渐变配色方案。
<div
className="bg-gradient-to-r bg-clip-text text-transparent from-indigo-500 to-purple-500"
>
SampleText
</div>
Run Code Online (Sandbox Code Playgroud)
我想对其进行动画处理,以便渐变在设定的持续时间内在from-indigo-500 to-purple-500和from-purple-500 to-indigo-500无限之间保持平滑变化。
Vue代码:
<template>
<div>
<v-card
color="grey darken-2"
dark
>
<v-card-text>
<v-autocomplete
spellcheck="false"
v-model="model"
:items="items"
:loading="isLoading"
:search-input.sync="search"
@change="search=''"
color="white"
hide-no-data
hide-selected
clearable
item-text="CodeAndName"
item-value="Code"
placeholder="Search stock symbols and names"
prepend-icon="mdi-account-search"
return-object
autofocus
dense
>
<template v-slot:item="{ item }">
<v-list>
<v-list-item-title class="justify-center">{{item.Code}}</v-list-item-title>
<v-list-item-subtitle>{{item.Name}}</v-list-item-subtitle>
<v-list-item-subtitle>{{item.Exchange}}</v-list-item-subtitle>
</v-list>
</template>
</v-autocomplete>
</v-card-text>
<v-divider></v-divider>
</v-card>
<Chart v-if="model" :exchangeCode="model.Exchange" :symbol="model.Code"/>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
JS代码:
import Chart from './GChart.vue'
export default {
name: "Search",
components: {
Chart,
},
data: () => ({
symbolsExchangesNames: [],
isLoading: false,
model: null,
search: null
}), …Run Code Online (Sandbox Code Playgroud) 该功能位于路由器视图之外的组件中。
goToMarkets(){
this.$router.push({path: '/markets', params: {stock: this.model}})
}
Run Code Online (Sandbox Code Playgroud)
但该道具在“市场”组件中未定义
路由器:
const routes = [
{
path: '/markets',
name: 'Markets',
component: Markets,
props: true
},]
Run Code Online (Sandbox Code Playgroud)
市场组成部分:
props: {
stock: Object
},
Run Code Online (Sandbox Code Playgroud)
该 prop 在 Markets 组件中未定义,即使它在传递之前(在第一个函数中)并未定义。